home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 January: Mac OS SDK / Dev.CD Jan 99 SDK2.toast / Development Kits / QuickTime / QuickTime 3 Interfaces & Libs / QTDevWin / CIncludes / Controls.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-21  |  84.9 KB  |  2,029 lines  |  [TEXT/dosa]

  1. /*
  2.      File:        Controls.h
  3.  
  4.      Contains:    Control Manager interfaces
  5.  
  6.      Version:    Technology:    Mac OS 8.1
  7.                  Release:    QuickTime 3.0
  8.  
  9.      Copyright:    © 1985-1998 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __CONTROLS__
  19. #define __CONTROLS__
  20.  
  21. #ifndef __MACTYPES__
  22. #include <MacTypes.h>
  23. #endif
  24. #ifndef __QUICKDRAW__
  25. #include <Quickdraw.h>
  26. #endif
  27. #ifndef __MENUS__
  28. #include <Menus.h>
  29. #endif
  30. #ifndef __TEXTEDIT__
  31. #include <TextEdit.h>
  32. #endif
  33. #ifndef __DRAG__
  34. #include <Drag.h>
  35. #endif
  36. #ifndef __ICONS__
  37. #include <Icons.h>
  38. #endif
  39.  
  40.  
  41.  
  42. #if PRAGMA_ONCE
  43. #pragma once
  44. #endif
  45.  
  46. #ifdef __cplusplus
  47. extern "C" {
  48. #endif
  49.  
  50. #if PRAGMA_IMPORT
  51. #pragma import on
  52. #endif
  53.  
  54. #if PRAGMA_STRUCT_ALIGN
  55.     #pragma options align=mac68k
  56. #elif PRAGMA_STRUCT_PACKPUSH
  57.     #pragma pack(push, 2)
  58. #elif PRAGMA_STRUCT_PACK
  59.     #pragma pack(2)
  60. #endif
  61.  
  62.  
  63. enum {
  64.     _ControlDispatch            = 0xAA73
  65. };
  66.  
  67.  
  68. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  69. /*    • Resource Types                                                                                    */
  70. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  71.  
  72. enum {
  73.     kControlDefProcType            = FOUR_CHAR_CODE('CDEF'),
  74.     kControlTemplateResourceType = FOUR_CHAR_CODE('CNTL'),
  75.     kControlColorTableResourceType = FOUR_CHAR_CODE('cctb'),
  76.     kControlDefProcResourceType    = FOUR_CHAR_CODE('CDEF'),
  77.     kControlTabListResType        = FOUR_CHAR_CODE('tab#'),        /* used for tab control (Appearance 1.0 and later)*/
  78.     kControlListDescResType        = FOUR_CHAR_CODE('ldes')        /* used for list box control (Appearance 1.0 and later)*/
  79. };
  80.  
  81. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  82. /*    • Format of a ‘CNTL’ resource                                                                        */
  83. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  84.  
  85. struct ControlTemplate {
  86.     Rect                             controlRect;
  87.     SInt16                             controlValue;
  88.     Boolean                         controlVisible;
  89.     UInt8                             fill;
  90.     SInt16                             controlMaximum;
  91.     SInt16                             controlMinimum;
  92.     SInt16                             controlDefProcID;
  93.     SInt32                             controlReference;
  94.     Str255                             controlTitle;
  95. };
  96. typedef struct ControlTemplate            ControlTemplate;
  97. typedef ControlTemplate *                ControlTemplatePtr;
  98. typedef ControlTemplatePtr *            ControlTemplateHandle;
  99.  
  100.  
  101. #if !TARGET_OS_MAC
  102. /*
  103.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  104.    • NON-MAC COMPATIBILITY CODES (QuickTime 3.0)
  105.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  106. */
  107.  
  108. typedef UInt32                             ControlNotification;
  109.  
  110. enum {
  111.     controlNotifyNothing        = FOUR_CHAR_CODE('nada'),        /* No (null) notification*/
  112.     controlNotifyClick            = FOUR_CHAR_CODE('clik'),        /* Control was clicked*/
  113.     controlNotifyFocus            = FOUR_CHAR_CODE('focu'),        /* Control got keyboard focus*/
  114.     controlNotifyKey            = FOUR_CHAR_CODE('key ')        /* Control got a keypress*/
  115. };
  116.  
  117. typedef UInt32                             ControlCapabilities;
  118.  
  119. enum {
  120.     kControlCanAutoInvalidate    = 1L << 0                        /* Control component automatically invalidates areas left behind after hide/move operation.*/
  121. };
  122.  
  123. /* procID's for our added "controls"*/
  124.  
  125. enum {
  126.     staticTextProc                = 256,                            /* static text*/
  127.     editTextProc                = 272,                            /* editable text*/
  128.     iconProc                    = 288,                            /* icon*/
  129.     userItemProc                = 304,                            /* user drawn item*/
  130.     pictItemProc                = 320                            /* pict*/
  131. };
  132.  
  133. #endif  /*  !TARGET_OS_MAC */
  134.  
  135. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  136. /*    • ControlHandle                                                                                        */
  137. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  138. typedef struct ControlRecord             ControlRecord;
  139. typedef ControlRecord *                    ControlPtr;
  140. typedef ControlPtr *                    ControlHandle;
  141. /* ControlRef is obsolete. Use ControlHandle. */
  142. typedef ControlHandle                     ControlRef;
  143. typedef SInt16                             ControlPartCode;
  144. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  145. /* • Control ActionProcPtr                                                                                */
  146. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  147. typedef CALLBACK_API( void , ControlActionProcPtr )(ControlHandle theControl, ControlPartCode partCode);
  148. typedef STACK_UPP_TYPE(ControlActionProcPtr)                     ControlActionUPP;
  149. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  150. /*    • ControlRecord                                                                                        */
  151. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  152.  
  153. struct ControlRecord {
  154.     ControlHandle                     nextControl;
  155.     WindowPtr                         contrlOwner;
  156.     Rect                             contrlRect;
  157.     UInt8                             contrlVis;
  158.     UInt8                             contrlHilite;
  159.     SInt16                             contrlValue;
  160.     SInt16                             contrlMin;
  161.     SInt16                             contrlMax;
  162.     Handle                             contrlDefProc;
  163.     Handle                             contrlData;
  164.     ControlActionUPP                 contrlAction;
  165.     SInt32                             contrlRfCon;
  166.     Str255                             contrlTitle;
  167. };
  168.  
  169. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  170. /* • Control ActionProcPtr : Epilogue                                                                    */
  171. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  172. enum { uppControlActionProcInfo = 0x000002C0 };                 /* pascal no_return_value Func(4_bytes, 2_bytes) */
  173. #define NewControlActionProc(userRoutine)                         (ControlActionUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlActionProcInfo, GetCurrentArchitecture())
  174. #define CallControlActionProc(userRoutine, theControl, partCode)  CALL_TWO_PARAMETER_UPP((userRoutine), uppControlActionProcInfo, (theControl), (partCode))
  175. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  176. /*    • Control Color Table                                                                                */
  177. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  178.  
  179. enum {
  180.     cFrameColor                    = 0,
  181.     cBodyColor                    = 1,
  182.     cTextColor                    = 2,
  183.     cThumbColor                    = 3,
  184.     kNumberCtlCTabEntries        = 4
  185. };
  186.  
  187.  
  188. struct CtlCTab {
  189.     SInt32                             ccSeed;
  190.     SInt16                             ccRider;
  191.     SInt16                             ctSize;
  192.     ColorSpec                         ctTable[4];
  193. };
  194. typedef struct CtlCTab                    CtlCTab;
  195.  
  196. typedef CtlCTab *                        CCTabPtr;
  197. typedef CCTabPtr *                        CCTabHandle;
  198. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  199. /*    • Auxiliary Control Record                                                                            */
  200. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  201.  
  202. struct AuxCtlRec {
  203.     Handle                             acNext;
  204.     ControlHandle                     acOwner;
  205.     CCTabHandle                     acCTable;
  206.     SInt16                             acFlags;
  207.     SInt32                             acReserved;
  208.     SInt32                             acRefCon;
  209. };
  210. typedef struct AuxCtlRec                AuxCtlRec;
  211.  
  212. typedef AuxCtlRec *                        AuxCtlPtr;
  213. typedef AuxCtlPtr *                        AuxCtlHandle;
  214. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  215. /*    • PopUp Menu Private Data Structure                                                                    */
  216. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  217.  
  218. struct PopupPrivateData {
  219.     MenuHandle                         mHandle;
  220.     SInt16                             mID;
  221. };
  222. typedef struct PopupPrivateData            PopupPrivateData;
  223. typedef PopupPrivateData *                PopupPrivateDataPtr;
  224. typedef PopupPrivateDataPtr *            PopupPrivateDataHandle;
  225.  
  226. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  227. /*    • Errors are in the range -30580 .. -30599                                                            */
  228. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  229.  
  230. enum {
  231.     errMessageNotSupported        = -30580,
  232.     errDataNotSupported            = -30581,
  233.     errControlDoesntSupportFocus = -30582,
  234.     errWindowDoesntSupportFocus    = -30583,
  235.     errUnknownControl            = -30584,
  236.     errCouldntSetFocus            = -30585,
  237.     errNoRootControl            = -30586,
  238.     errRootAlreadyExists        = -30587,
  239.     errInvalidPartCode            = -30588,
  240.     errControlsAlreadyExist        = -30589,
  241.     errControlIsNotEmbedder        = -30590,
  242.     errDataSizeMismatch            = -30591,
  243.     errControlHiddenOrDisabled    = -30592,
  244.     errWindowRegionCodeInvalid    = -30593,
  245.     errCantEmbedIntoSelf        = -30594,
  246.     errCantEmbedRoot            = -30595,
  247.     errItemNotControl            = -30596
  248. };
  249.  
  250. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  251. /*    • Control Definition ID’s                                                                            */
  252. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  253. /* Standard System 7 procIDs*/
  254.  
  255.  
  256. enum {
  257.     pushButProc                    = 0,
  258.     checkBoxProc                = 1,
  259.     radioButProc                = 2,
  260.     scrollBarProc                = 16,
  261.     popupMenuProc                = 1008
  262. };
  263.  
  264.  
  265. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  266. /*    • Control Types and ID’s available only with Appearance 1.0 and later                                */
  267. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  268.  
  269.  
  270. enum {
  271.     kControlSupportsNewMessages    = FOUR_CHAR_CODE(' ok ')        /* CDEF should return as result of kControlMsgTestNewMsgSupport*/
  272. };
  273.  
  274. /* focusing part codes */
  275.  
  276. enum {
  277.     kControlFocusNoPart            = 0,                            /* tells control to clear its focus*/
  278.     kControlFocusNextPart        = -1,                            /* tells control to focus on the next part*/
  279.     kControlFocusPrevPart        = -2                            /* tells control to focus on the previous part*/
  280. };
  281.  
  282.  
  283. typedef SInt16                             ControlFocusPart;
  284. /* Key Filter result codes                                                             */
  285. /*                                                                                    */
  286. /* Certain controls can have a keyfilter attached to them. The filter proc should    */
  287. /* return one of the two constants below. If kKeyFilterBlockKey is returned, the    */
  288. /* key is blocked and never makes it to the control. If kKeyFilterPassKey is        */
  289. /* returned, the control receives the keystroke.                                    */
  290.  
  291. enum {
  292.     kControlKeyFilterBlockKey    = 0,
  293.     kControlKeyFilterPassKey    = 1
  294. };
  295.  
  296. typedef SInt16                             ControlKeyFilterResult;
  297. /*——————————————————————————————————————————————————————————————————————————————————————*/
  298. /*     SPECIAL FONT USAGE NOTES: You can specify the font to use for many control types.
  299.     The constants below are meta-font numbers which you can use to set a particular
  300.     control's font usage. There are essentially two modes you can use: 1) default,
  301.     which is essentially the same as it always has been, i.e. it uses the system font, unless
  302.     directed to use the window font via a control variant. 2) you can specify to use
  303.     the big or small system font in a generic manner. The Big system font is the font
  304.     used in menus, etc. Chicago has filled that role for some time now. Small system
  305.     font is currently Geneva 10. The meta-font number implies the size and style.
  306.     
  307.     NOTE:        Not all font attributes are used by all controls. Most, in fact, ignore
  308.                 the fore and back color (Static Text is the only one that does, for
  309.                 backwards compatibility). Also size, face, and addFontSize are ignored
  310.                 when using the meta-font numbering.
  311. */
  312. /*——————————————————————————————————————————————————————————————————————————————————————*/
  313.  
  314. enum {
  315.                                                                 /* Meta-font numbering - see not above */
  316.     kControlFontBigSystemFont    = -1,                            /* force to big system font*/
  317.     kControlFontSmallSystemFont    = -2,                            /* force to small system font*/
  318.     kControlFontSmallBoldSystemFont = -3                        /* force to small bold system font*/
  319. };
  320.  
  321. /* Add these masks together to set the flags field of a ControlFontStyleRec    */
  322. /* They specify which fields to apply to the text. It is important to make    */
  323. /* sure that you specify only the fields that you wish to set.                */
  324.  
  325. enum {
  326.     kControlUseFontMask            = 0x0001,
  327.     kControlUseFaceMask            = 0x0002,
  328.     kControlUseSizeMask            = 0x0004,
  329.     kControlUseForeColorMask    = 0x0008,
  330.     kControlUseBackColorMask    = 0x0010,
  331.     kControlUseModeMask            = 0x0020,
  332.     kControlUseJustMask            = 0x0040,
  333.     kControlUseAllMask            = 0x00FF,
  334.     kControlAddFontSizeMask        = 0x0100
  335. };
  336.  
  337.  
  338. struct ControlFontStyleRec {
  339.     SInt16                             flags;
  340.     SInt16                             font;
  341.     SInt16                             size;
  342.     SInt16                             style;
  343.     SInt16                             mode;
  344.     SInt16                             just;
  345.     RGBColor                         foreColor;
  346.     RGBColor                         backColor;
  347. };
  348. typedef struct ControlFontStyleRec        ControlFontStyleRec;
  349.  
  350. typedef ControlFontStyleRec *            ControlFontStylePtr;
  351. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  352. /*    • Common data tags for Get/SetControlData                                                            */
  353. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  354.  
  355. enum {
  356.     kControlFontStyleTag        = FOUR_CHAR_CODE('font'),
  357.     kControlKeyFilterTag        = FOUR_CHAR_CODE('fltr')
  358. };
  359.  
  360.  
  361. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  362. /*    • Control Feature Bits                                                                                */
  363. /*——————————————————————————————————————————————————————————————————————————————————————————————————————*/
  364.  
  365. enum {
  366.                                                                 /* Control feature bits - returned by GetControlFeatures */
  367.     kControlSupportsGhosting    = 1 << 0,
  368.     kControlSupportsEmbedding    = 1 << 1,
  369.     kControlSupportsFocus        = 1 << 2,
  370.     kControlWantsIdle            = 1 << 3,
  371.     kControlWantsActivate        = 1 << 4,
  372.     kControlHandlesTracking        = 1 << 5,
  373.     kControlSupportsDataAccess    = 1 << 6,
  374.     kControlHasSpecialBackground = 1 << 7,
  375.     kControlGetsFocusOnClick    = 1 << 8,
  376.     kControlSupportsCalcBestRect = 1 << 9,
  377.     kControlSupportsLiveFeedback = 1 << 10
  378. };
  379.  
  380. /* Features introduced in Appearance 1.0.1 */
  381.  
  382. enum {
  383.     kControlHasRadioBehavior    = 1 << 11
  384. };
  385.  
  386. /* Control Messages */
  387.  
  388. enum {
  389.     kControlMsgDrawGhost        = 13,
  390.     kControlMsgCalcBestRect        = 14,                            /* Calculate best fitting rectangle for control*/
  391.     kControlMsgHandleTracking    = 15,
  392.     kControlMsgFocus            = 16,                            /* param indicates action.*/
  393.     kControlMsgKeyDown            = 17,
  394.     kControlMsgIdle                = 18,
  395.     kControlMsgGetFeatures        = 19,
  396.     kControlMsgSetData            = 20,
  397.     kControlMsgGetData            = 21,
  398.     kControlMsgActivate            = 22,
  399.     kControlMsgSetUpBackground    = 23,
  400.     kControlMsgCalcValueFromPos    = 26,
  401.     kControlMsgTestNewMsgSupport = 27                            /* See if this control supports new messaging*/
  402. };
  403.  
  404. /* Messages in Appearance 1.0.1 or later*/
  405.  
  406. enum {
  407.     kControlMsgSubValueChanged    = 25,
  408.     kControlMsgSubControlAdded    = 28,
  409.     kControlMsgSubControlRemoved = 29
  410. };
  411.  
  412. /*——————————————————————————————————————————————————————————————————————————————————————*/
  413. /*     This structure is passed into a CDEF when called with the kControlMsgHandleTracking    */
  414. /*    message                                                                             */
  415. /*——————————————————————————————————————————————————————————————————————————————————————*/
  416.  
  417. struct ControlTrackingRec {
  418.     Point                             startPt;
  419.     SInt16                             modifiers;
  420.     ControlActionUPP                 action;
  421. };
  422. typedef struct ControlTrackingRec        ControlTrackingRec;
  423.  
  424. typedef ControlTrackingRec *            ControlTrackingPtr;
  425. /*——————————————————————————————————————————————————————————————————————————————————————*/
  426. /* This structure is passed into a CDEF when called with the kControlMsgKeyDown message */
  427. /*——————————————————————————————————————————————————————————————————————————————————————*/
  428.  
  429. struct ControlKeyDownRec {
  430.     SInt16                             modifiers;
  431.     SInt16                             keyCode;
  432.     SInt16                             charCode;
  433. };
  434. typedef struct ControlKeyDownRec        ControlKeyDownRec;
  435.  
  436. typedef ControlKeyDownRec *                ControlKeyDownPtr;
  437. /*——————————————————————————————————————————————————————————————————————————————————————*/
  438. /* This structure is passed into a CDEF when called with the kControlMsgGetData or        */
  439. /* kControlMsgSetData message                                                             */
  440. /*——————————————————————————————————————————————————————————————————————————————————————*/
  441.  
  442. struct ControlDataAccessRec {
  443.     ResType                         tag;
  444.     ResType                         part;
  445.     Size                             size;
  446.     Ptr                             dataPtr;
  447. };
  448. typedef struct ControlDataAccessRec        ControlDataAccessRec;
  449.  
  450. typedef ControlDataAccessRec *            ControlDataAccessPtr;
  451. /*——————————————————————————————————————————————————————————————————————————————————————*/
  452. /* This structure is passed into a CDEF when called with the kControlCalcBestRect msg     */
  453. /*——————————————————————————————————————————————————————————————————————————————————————*/
  454.  
  455. struct ControlCalcSizeRec {
  456.     SInt16                             height;
  457.     SInt16                             width;
  458.     SInt16                             baseLine;
  459. };
  460. typedef struct ControlCalcSizeRec        ControlCalcSizeRec;
  461.  
  462. typedef ControlCalcSizeRec *            ControlCalcSizePtr;
  463. /*——————————————————————————————————————————————————————————————————————————————————————*/
  464. /* This structure is passed into a CDEF when called with the kControlMsgSetUpBackground */
  465. /* message is sent                                                                        */
  466. /*——————————————————————————————————————————————————————————————————————————————————————*/
  467.  
  468. struct ControlBackgroundRec {
  469.     SInt16                             depth;
  470.     Boolean                         colorDevice;
  471. };
  472. typedef struct ControlBackgroundRec        ControlBackgroundRec;
  473.  
  474. typedef ControlBackgroundRec *            ControlBackgroundPtr;
  475. /*——————————————————————————————————————————————————————————————————————————————————————*/
  476. /* This structure is passed into a CDEF when called with the kControlMsgApplyTextColor    */
  477. /* message is sent                                                                        */
  478. /*——————————————————————————————————————————————————————————————————————————————————————*/
  479.  
  480. struct ControlApplyTextColorRec {
  481.     SInt16                             depth;
  482.     Boolean                         colorDevice;
  483.     Boolean                         active;
  484. };
  485. typedef struct ControlApplyTextColorRec    ControlApplyTextColorRec;
  486.  
  487. typedef ControlApplyTextColorRec *        ControlApplyTextColorPtr;
  488. /*——————————————————————————————————————————————————————————————————————————————————————*/
  489. /*    Key Filter                                                                            */
  490. /*                                                                                        */
  491. /* Definition of a key filter for intercepting and possibly changing keystrokes            */
  492. /* which are destined for a control                                                        */
  493. /*——————————————————————————————————————————————————————————————————————————————————————*/
  494. typedef CALLBACK_API( ControlKeyFilterResult , ControlKeyFilterProcPtr )(ControlHandle theControl, SInt16 *keyCode, SInt16 *charCode, SInt16 *modifiers);
  495. typedef STACK_UPP_TYPE(ControlKeyFilterProcPtr)                 ControlKeyFilterUPP;
  496. enum { uppControlKeyFilterProcInfo = 0x00003FE0 };                 /* pascal 2_bytes Func(4_bytes, 4_bytes, 4_bytes, 4_bytes) */
  497. #define NewControlKeyFilterProc(userRoutine)                     (ControlKeyFilterUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlKeyFilterProcInfo, GetCurrentArchitecture())
  498. #define CallControlKeyFilterProc(userRoutine, theControl, keyCode, charCode, modifiers)  CALL_FOUR_PARAMETER_UPP((userRoutine), uppControlKeyFilterProcInfo, (theControl), (keyCode), (charCode), (modifiers))
  499. /*——————————————————————————————————————————————————————————————————————————————————————*/
  500. /*    • BEVEL BUTTON INTERFACE (CDEF 2)                                                    */
  501. /*——————————————————————————————————————————————————————————————————————————————————————*/
  502. /*    Bevel buttons allow you to control the content type (pict/icon/etc.), the behavior    */
  503. /* (pushbutton/toggle/sticky), and the bevel size. You also have the option of            */
  504. /*    attaching a menu to it. When a menu is present, you can specify which way the         */
  505. /*    popup arrow is facing (down or right).                                                */
  506. /*                                                                                        */
  507. /*    This is all made possible by overloading the Min, Max, and Value parameters for the    */
  508. /*    control, as well as adjusting the variant. Here's the breakdown of what goes where:    */
  509. /*                                                                                        */
  510. /*    Parameter                    What Goes Here                                            */
  511. /*    ———————————————————            ————————————————————————————————————————————————————    */
  512. /*    Min                            Hi Byte = Behavior, Lo Byte = content type.                */
  513. /*    Max                            ResID for resource-based content types.                    */
  514. /*    Value                        MenuID to attach, 0 = no menu, please.                    */
  515. /*                                                                                        */
  516. /*    The variant is broken down into two halfs. The low 2 bits control the bevel type.    */
  517. /*    Bit 2 controls the popup arrow direction (if a menu is present) and bit 3 controls    */
  518. /*    whether or not to use the control's owning window's font.                            */
  519. /*                                                                                        */
  520. /*    Constants for all you need to put this together are below. The values for behaviors    */
  521. /*    are set up so that you can simply add them to the content type and pass them into    */
  522. /*    the Min parameter of NewControl.                                                    */
  523. /*                                                                                        */
  524. /*    An example call:                                                                    */
  525. /*                                                                                        */
  526. /*    control = NewControl( window, &bounds, "\p", true, 0, kContentIconSuiteRes +         */
  527. /*                            kBehaviorToggles, myIconSuiteID, bevelButtonSmallBevelProc,    */
  528. /*                            0L );                                                        */
  529. /*                                                                                        */
  530. /*    Attaching a menu:                                                                    */
  531. /*                                                                                        */
  532. /*    control = NewControl( window, &bounds, "\p", true, kMyMenuID, kContentIconSuiteRes,    */
  533. /*            myIconSuiteID, bevelButtonSmallBevelProc + kBevelButtonMenuOnRight, 0L );    */
  534. /*                                                                                        */
  535. /*    This will attach menu ID kMyMenuID to the button, with the popup arrow facing right.*/
  536. /*    This also puts the menu up to the right of the button. You can also specify that a    */
  537. /*    menu can have multiple items checked at once by adding kBehaviorMultiValueMenus        */
  538. /*    into the Min parameter. If you do use multivalue menus, the GetBevelButtonMenuValue    */
  539. /*    helper function will return the last item chosen from the menu, whether or not it    */
  540. /*    was checked.                                                                        */
  541. /*                                                                                        */
  542. /*    NOTE:     Bevel buttons with menus actually have *two* values. The value of the         */
  543. /*            button (on/off), and the value of the menu. The menu value can be gotten    */
  544. /*            with the GetBevelButtonMenuValue helper function.                            */
  545. /*                                                                                        */
  546. /*    Handle-based Content                                                                */
  547. /*    ————————————————————                                                                */
  548. /*    You can create your control and then set the content to an existing handle to an    */
  549. /*    icon suite, etc. using the macros below. Please keep in mind that resource-based    */
  550. /*    content is owned by the control, handle-based content is owned by you. The CDEF will*/
  551. /*    not try to dispose of handle-based content. If you are changing the content type of    */
  552. /*    the button on the fly, you must make sure that if you are replacing a handle-        */
  553. /*    based content with a resource-based content to properly dispose of the handle,        */
  554. /*    else a memory leak will ensue.                                                        */
  555. /*                                                                                        */
  556.  
  557. enum {
  558.                                                                 /* Bevel Button Proc IDs */
  559.     kControlBevelButtonSmallBevelProc = 32,
  560.     kControlBevelButtonNormalBevelProc = 33,
  561.     kControlBevelButtonLargeBevelProc = 34
  562. };
  563.  
  564.  
  565. enum {
  566.                                                                 /* Bevel button graphic alignment values */
  567.     kControlBevelButtonAlignSysDirection = -1,                    /* only left or right*/
  568.     kControlBevelButtonAlignCenter = 0,
  569.     kControlBevelButtonAlignLeft = 1,
  570.     kControlBevelButtonAlignRight = 2,
  571.     kControlBevelButtonAlignTop    = 3,
  572.     kControlBevelButtonAlignBottom = 4,
  573.     kControlBevelButtonAlignTopLeft = 5,
  574.     kControlBevelButtonAlignBottomLeft = 6,
  575.     kControlBevelButtonAlignTopRight = 7,
  576.     kControlBevelButtonAlignBottomRight = 8
  577. };
  578.  
  579. typedef SInt16                             ControlButtonGraphicAlignment;
  580.  
  581. enum {
  582.                                                                 /* Bevel button text alignment values */
  583.     kControlBevelButtonAlignTextSysDirection = teFlushDefault,
  584.     kControlBevelButtonAlignTextCenter = teCenter,
  585.     kControlBevelButtonAlignTextFlushRight = teFlushRight,
  586.     kControlBevelButtonAlignTextFlushLeft = teFlushLeft
  587. };
  588.  
  589. typedef SInt16                             ControlButtonTextAlignment;
  590.  
  591. enum {
  592.                                                                 /* Bevel button text placement values */
  593.     kControlBevelButtonPlaceSysDirection = -1,                    /* if graphic on right, then on left*/
  594.     kControlBevelButtonPlaceNormally = 0,
  595.     kControlBevelButtonPlaceToRightOfGraphic = 1,
  596.     kControlBevelButtonPlaceToLeftOfGraphic = 2,
  597.     kControlBevelButtonPlaceBelowGraphic = 3,
  598.     kControlBevelButtonPlaceAboveGraphic = 4
  599. };
  600.  
  601. typedef SInt16                             ControlButtonTextPlacement;
  602. /* Add these variant codes to kBevelButtonSmallBevelProc to change the type of button */
  603.  
  604. enum {
  605.     kControlBevelButtonSmallBevelVariant = 0,
  606.     kControlBevelButtonNormalBevelVariant = (1 << 0),
  607.     kControlBevelButtonLargeBevelVariant = (1 << 1),
  608.     kControlBevelButtonMenuOnRight = (1 << 2)
  609. };
  610.  
  611. /*
  612.    Behaviors of bevel buttons. These are set up so you can add
  613.    them together with the content types.
  614. */
  615.  
  616. enum {
  617.     kControlBehaviorPushbutton    = 0,
  618.     kControlBehaviorToggles        = 0x0100,
  619.     kControlBehaviorSticky        = 0x0200,
  620.     kControlBehaviorMultiValueMenu = 0x4000,                    /* only makes sense when a menu is attached.*/
  621.     kControlBehaviorOffsetContents = 0x8000
  622. };
  623.  
  624. /* Behaviors for 1.0.1 or later */
  625.  
  626. enum {
  627.     kControlBehaviorCommandMenu    = 0x2000                        /* menu holds commands, not choices. Overrides multi-value bit.*/
  628. };
  629.  
  630. /* Content types supported by bevel buttons *and* image wells*/
  631.  
  632. enum {
  633.     kControlContentTextOnly        = 0,
  634.     kControlContentIconSuiteRes    = 1,
  635.     kControlContentCIconRes        = 2,
  636.     kControlContentPictRes        = 3,
  637.     kControlContentIconSuiteHandle = 129,
  638.     kControlContentCIconHandle    = 130,
  639.     kControlContentPictHandle    = 131,
  640.     kControlContentIconRef        = 132
  641. };
  642.  
  643. typedef SInt16                             ControlContentType;
  644. /* Data tags supported by the bevel button controls */
  645.  
  646. enum {
  647.     kControlBevelButtonContentTag = FOUR_CHAR_CODE('cont'),        /* ButtonContentInfo*/
  648.     kControlBevelButtonTransformTag = FOUR_CHAR_CODE('tran'),    /* IconTransformType*/
  649.     kControlBevelButtonTextAlignTag = FOUR_CHAR_CODE('tali'),    /* ButtonTextAlignment*/
  650.     kControlBevelButtonTextOffsetTag = FOUR_CHAR_CODE('toff'),    /* SInt16*/
  651.     kControlBevelButtonGraphicAlignTag = FOUR_CHAR_CODE('gali'), /* ButtonGraphicAlignment*/
  652.     kControlBevelButtonGraphicOffsetTag = FOUR_CHAR_CODE('goff'), /* Point*/
  653.     kControlBevelButtonTextPlaceTag = FOUR_CHAR_CODE('tplc'),    /* ButtonTextPlacement*/
  654.     kControlBevelButtonMenuValueTag = FOUR_CHAR_CODE('mval'),    /* SInt16*/
  655.     kControlBevelButtonMenuHandleTag = FOUR_CHAR_CODE('mhnd'),    /* MenuHandle*/
  656.     kControlBevelButtonCenterPopupGlyphTag = FOUR_CHAR_CODE('pglc') /* Boolean: true = center, false = bottom right*/
  657. };
  658.  
  659. /* These are tags in 1.0.1 or later */
  660.  
  661. enum {
  662.     kControlBevelButtonLastMenuTag = FOUR_CHAR_CODE('lmnu'),    /* SInt16: menuID of last menu item selected from*/
  663.     kControlBevelButtonMenuDelayTag = FOUR_CHAR_CODE('mdly')    /* SInt32: ticks to delay before menu appears*/
  664. };
  665.  
  666. /* Structure to pass into bevel buttons and image wells to set/get content type */
  667.  
  668. struct ControlButtonContentInfo {
  669.     ControlContentType                 contentType;
  670.     union {
  671.         SInt16                             resID;
  672.         CIconHandle                     cIconHandle;
  673.         Handle                             iconSuite;
  674.         Handle                             iconRef;
  675.         PicHandle                         picture;
  676.     }                                 u;
  677. };
  678. typedef struct ControlButtonContentInfo    ControlButtonContentInfo;
  679. typedef ControlButtonContentInfo *        ControlButtonContentInfoPtr;
  680. /*——————————————————————————————————————————————————————————————————————————————————————*/
  681. /*    • SLIDER (CDEF 3)                                                                    */
  682. /*——————————————————————————————————————————————————————————————————————————————————————*/
  683. /*    There are several variants that control the behavior of the slider control. Any        */
  684. /*    combination of the following three constants can be added to the basic CDEF ID        */
  685. /*    (kSliderProc).                                                                        */
  686. /*                                                                                        */
  687. /*    Variants:                                                                            */
  688. /*                                                                                        */
  689. /*        kSliderLiveFeedback         Slider does not use "ghosted" indicator when tracking.    */
  690. /*                                ActionProc is called (set via SetControlAction) as the    */
  691. /*                                indicator is dragged. The value is updated so that the    */
  692. /*                                actionproc can adjust some other property based on the    */
  693. /*                                value each time the action proc is called. If no action    */
  694. /*                                proc is installed, it reverts to the ghost indicator.    */
  695. /*                                                                                        */
  696. /*        kSliderHasTickMarks         Slider is drawn with 'tick marks'. The control            */
  697. /*                                rectangle must be large enough to accomidate the tick    */
  698. /*                                marks.                                                    */
  699. /*                                                                                        */
  700. /*        kSliderReverseDirection    Slider thumb points in opposite direction than normal.    */
  701. /*                                If the slider is vertical, the thumb will point to the    */
  702. /*                                left, if the slider is horizontal, the thumb will point    */
  703. /*                                upwards.                                                */
  704. /*                                                                                        */
  705. /*        kSliderNonDirectional    This option overrides the kSliderReverseDirection and    */
  706. /*                                kSliderHasTickMarks variants. It creates an indicator    */
  707. /*                                which is rectangular and doesn't point in any direction    */
  708. /*                                like the normal indicator does.                            */
  709.  
  710. enum {
  711.                                                                 /* Slider proc IDs */
  712.     kControlSliderProc            = 48,
  713.     kControlSliderLiveFeedback    = (1 << 0),
  714.     kControlSliderHasTickMarks    = (1 << 1),
  715.     kControlSliderReverseDirection = (1 << 2),
  716.     kControlSliderNonDirectional = (1 << 3)
  717. };
  718.  
  719.  
  720. /*——————————————————————————————————————————————————————————————————————————————————————*/
  721. /*    • DISCLOSURE TRIANGLE (CDEF 4)                                                        */
  722. /*——————————————————————————————————————————————————————————————————————————————————————*/
  723. /*    This control can be used as either left or right facing. It can also handle its own    */
  724. /*    tracking if you wish. This means that when the 'autotoggle' variant is used, if the    */
  725. /*    user clicks the control, it's state will change automatically from open to closed    */
  726. /*    and vice-versa depending on its initial state. After a successful call to Track-    */
  727. /*     Control, you can just check the current value to see what state it was switched to.    */
  728.  
  729. enum {
  730.                                                                 /* Triangle proc IDs */
  731.     kControlTriangleProc        = 64,
  732.     kControlTriangleLeftFacingProc = 65,
  733.     kControlTriangleAutoToggleProc = 66,
  734.     kControlTriangleLeftFacingAutoToggleProc = 67
  735. };
  736.  
  737.  
  738. enum {
  739.                                                                 /* Tagged data supported by disclosure triangles */
  740.     kControlTriangleLastValueTag = FOUR_CHAR_CODE('last')        /* SInt16*/
  741. };
  742.  
  743. /*——————————————————————————————————————————————————————————————————————————————————————*/
  744. /*    • PROGRESS INDICATOR (CDEF 5)                                                        */
  745. /*——————————————————————————————————————————————————————————————————————————————————————*/
  746. /*    This CDEF implements both determinate and indeterminate progress bars. To switch,     */
  747. /*    just use SetControlData to set the indeterminate flag to make it indeterminate call    */
  748. /*    IdleControls to step thru the animation. IdleControls should be called at least        */
  749. /*    once during your event loop.                                                        */
  750. /*                                                                                        */
  751.  
  752. enum {
  753.                                                                 /* Progress Bar proc IDs */
  754.     kControlProgressBarProc        = 80
  755. };
  756.  
  757.  
  758. enum {
  759.                                                                 /* Tagged data supported by progress bars */
  760.     kControlProgressBarIndeterminateTag = FOUR_CHAR_CODE('inde') /* Boolean*/
  761. };
  762.  
  763. /*——————————————————————————————————————————————————————————————————————————————————————*/
  764. /*    • LITTLE ARROWS (CDEF 6)                                                            */
  765. /*——————————————————————————————————————————————————————————————————————————————————————*/
  766. /*     This control implements the little up and down arrows you'd see in the Memory        */
  767. /*    control panel for adjusting the cache size.                                         */
  768.  
  769. enum {
  770.                                                                 /* Little Arrows proc IDs */
  771.     kControlLittleArrowsProc    = 96
  772. };
  773.  
  774. /*——————————————————————————————————————————————————————————————————————————————————————*/
  775. /*    • CHASING ARROWS (CDEF 7)                                                            */
  776. /*——————————————————————————————————————————————————————————————————————————————————————*/
  777. /*    To animate this control, make sure to call IdleControls repeatedly.                    */
  778. /*                                                                                        */
  779.  
  780. enum {
  781.                                                                 /* Chasing Arrows proc IDs */
  782.     kControlChasingArrowsProc    = 112
  783. };
  784.  
  785. /*——————————————————————————————————————————————————————————————————————————————————————*/
  786. /*    • TABS (CDEF 8)                                                                        */
  787. /*——————————————————————————————————————————————————————————————————————————————————————*/
  788. /*    Tabs use an auxiliary resource (tab#) to hold tab information such as the tab name    */
  789. /*    and an icon suite ID for each tab.                                                    */
  790. /*                                                                                        */
  791. /*    The ID of the tab# resource that you wish to associate with a tab control should     */
  792. /*    be passed in as the Value parameter of the control. If you are using GetNewControl, */
  793. /*    then the Value slot in the CNTL resource should have the ID of the 'tab#' resource    */
  794. /*    on creation.                                                                        */
  795. /*                                                                                        */
  796. /*    Passing zero in for the tab# resource tells the control not to read in a tab# res.    */
  797. /*    You can then use SetControlMaximum to add tabs, followed by a call to SetControlData*/
  798. /*    with the kControlTabInfoTag, passing in a pointer to a ControlTabInfoRec. This sets    */
  799. /*     the name and optionally an icon for a tab.                                            */
  800.  
  801. enum {
  802.                                                                 /* Tabs proc IDs */
  803.     kControlTabLargeProc        = 128,                            /* Large tab size, north facing    */
  804.     kControlTabSmallProc        = 129,                            /* Small tab size, north facing    */
  805.     kControlTabLargeNorthProc    = 128,                            /* Large tab size, north facing    */
  806.     kControlTabSmallNorthProc    = 129,                            /* Small tab size, north facing    */
  807.     kControlTabLargeSouthProc    = 130,                            /* Large tab size, south facing    */
  808.     kControlTabSmallSouthProc    = 131,                            /* Small tab size, south facing    */
  809.     kControlTabLargeEastProc    = 132,                            /* Large tab size, east facing    */
  810.     kControlTabSmallEastProc    = 133,                            /* Small tab size, east facing    */
  811.     kControlTabLargeWestProc    = 134,                            /* Large tab size, west facing    */
  812.     kControlTabSmallWestProc    = 135                            /* Small tab size, west facing    */
  813. };
  814.  
  815.  
  816. enum {
  817.                                                                 /* Tagged data supported by progress bars */
  818.     kControlTabContentRectTag    = FOUR_CHAR_CODE('rect'),        /* Rect*/
  819.     kControlTabEnabledFlagTag    = FOUR_CHAR_CODE('enab'),        /* Boolean*/
  820.     kControlTabFontStyleTag        = kControlFontStyleTag            /* ControlFontStyleRec*/
  821. };
  822.  
  823. /* New tags in 1.0.1 or later */
  824.  
  825. enum {
  826.     kControlTabInfoTag            = FOUR_CHAR_CODE('tabi')        /* ControlTabInfoRec*/
  827. };
  828.  
  829.  
  830. enum {
  831.     kControlTabInfoVersionZero    = 0
  832. };
  833.  
  834.  
  835. struct ControlTabInfoRec {
  836.     SInt16                             version;                    /* version of this structure.*/
  837.     SInt16                             iconSuiteID;                /* icon suite to use. Zero indicates no icon*/
  838.     Str255                             name;                        /* name to be displayed on the tab*/
  839. };
  840. typedef struct ControlTabInfoRec        ControlTabInfoRec;
  841. /*——————————————————————————————————————————————————————————————————————————————————————*/
  842. /*    • VISUAL SEPARATOR (CDEF 9)                                                            */
  843. /*——————————————————————————————————————————————————————————————————————————————————————*/
  844. /*    Separator lines determine their orientation (horizontal or vertical) automatically    */
  845. /*    based on the relative height and width of their contrlRect.                            */
  846.  
  847. enum {
  848.                                                                 /* Visual separator proc IDs */
  849.     kControlSeparatorLineProc    = 144
  850. };
  851.  
  852.  
  853. /*——————————————————————————————————————————————————————————————————————————————————————*/
  854. /*    • GROUP BOX (CDEF 10)                                                                */
  855. /*——————————————————————————————————————————————————————————————————————————————————————*/
  856. /*    The group box CDEF can be use in several ways. It can have no title, a text title,     */
  857. /*    a check box as the title, or a popup button as a title. There are two versions of     */
  858. /*    group boxes, primary and secondary, which look slightly different.                    */
  859.  
  860. enum {
  861.                                                                 /* Group Box proc IDs */
  862.     kControlGroupBoxTextTitleProc = 160,
  863.     kControlGroupBoxCheckBoxProc = 161,
  864.     kControlGroupBoxPopupButtonProc = 162,
  865.     kControlGroupBoxSecondaryTextTitleProc = 164,
  866.     kControlGroupBoxSecondaryCheckBoxProc = 165,
  867.     kControlGroupBoxSecondaryPopupButtonProc = 166
  868. };
  869.  
  870.  
  871. enum {
  872.                                                                 /* Tagged data supported by group box */
  873.     kControlGroupBoxMenuHandleTag = FOUR_CHAR_CODE('mhan'),        /* MenuHandle (popup title only)*/
  874.     kControlGroupBoxFontStyleTag = kControlFontStyleTag            /* ControlFontStyleRec*/
  875. };
  876.  
  877. /*——————————————————————————————————————————————————————————————————————————————————————*/
  878. /*    • IMAGE WELL (CDEF 11)                                                                */
  879. /*——————————————————————————————————————————————————————————————————————————————————————*/
  880. /*    Image Wells allow you to control the content type (pict/icon/etc.) shown in the     */
  881. /*    well.                                                                                */
  882. /*                                                                                        */
  883. /*    This is made possible by overloading the Min and Value parameters for the control.    */
  884. /*                                                                                        */
  885. /*    Parameter                    What Goes Here                                            */
  886. /*    ———————————————————            ——————————————————————————————————————————————————        */
  887. /*    Min                            content type (see constants for bevel buttons)            */
  888. /*    Value                        Resource ID of content type, if resource-based.            */
  889. /*                                                                                        */
  890. /*                                                                                        */
  891. /*    Handle-based Content                                                                */
  892. /*    ————————————————————                                                                */
  893. /*    You can create your control and then set the content to an existing handle to an    */
  894. /*    icon suite, etc. using the macros below. Please keep in mind that resource-based    */
  895. /*    content is owned by the control, handle-based content is owned by you. The CDEF will*/
  896. /*    not try to dispose of handle-based content. If you are changing the content type of    */
  897. /*    the button on the fly, you must make sure that if you are replacing a handle-        */
  898. /*    based content with a resource-based content to properly dispose of the handle,        */
  899. /*    else a memory leak will ensue.                                                        */
  900. /*                                                                                        */
  901.  
  902. enum {
  903.                                                                 /* Image Well proc IDs */
  904.     kControlImageWellProc        = 176
  905. };
  906.  
  907.  
  908. enum {
  909.                                                                 /* Tagged data supported by image wells */
  910.     kControlImageWellContentTag    = FOUR_CHAR_CODE('cont'),        /* ButtonContentInfo*/
  911.     kControlImageWellTransformTag = FOUR_CHAR_CODE('tran')        /* IconTransformType*/
  912. };
  913.  
  914. /*——————————————————————————————————————————————————————————————————————————————————————*/
  915. /*    • POPUP ARROW (CDEF 12)                                                                */
  916. /*——————————————————————————————————————————————————————————————————————————————————————*/
  917. /*    The popup arrow CDEF is used to draw the small arrow normally associated with a     */
  918. /*    popup control. The arrow can point in four directions, and a small or large version */
  919. /*    can be used. This control is provided to allow clients to draw the arrow in a         */
  920. /*    normalized fashion which will take advantage of themes automatically.                */
  921. /*                                                                                        */
  922.  
  923. enum {
  924.                                                                 /* Popup Arrow proc IDs */
  925.     kControlPopupArrowEastProc    = 192,
  926.     kControlPopupArrowWestProc    = 193,
  927.     kControlPopupArrowNorthProc    = 194,
  928.     kControlPopupArrowSouthProc    = 195,
  929.     kControlPopupArrowSmallEastProc = 196,
  930.     kControlPopupArrowSmallWestProc = 197,
  931.     kControlPopupArrowSmallNorthProc = 198,
  932.     kControlPopupArrowSmallSouthProc = 199
  933. };
  934.  
  935. /*——————————————————————————————————————————————————————————————————————————————————————*/
  936. /*    • PLACARD (CDEF 14)                                                                    */
  937. /*——————————————————————————————————————————————————————————————————————————————————————*/
  938.  
  939. enum {
  940.                                                                 /* Placard proc IDs */
  941.     kControlPlacardProc            = 224
  942. };
  943.  
  944. /*——————————————————————————————————————————————————————————————————————————————————————*/
  945. /*    • CLOCK (CDEF 15)                                                                    */
  946. /*——————————————————————————————————————————————————————————————————————————————————————*/
  947. /*     NOTE:    You can specify more options in the Value paramter when creating the clock.    */
  948. /*            See below.                                                                    */
  949.  
  950. enum {
  951.                                                                 /* Clock proc IDs */
  952.     kControlClockTimeProc        = 240,
  953.     kControlClockTimeSecondsProc = 241,
  954.     kControlClockDateProc        = 242,
  955.     kControlClockMonthYearProc    = 243
  956. };
  957.  
  958. /*——————————————————————————————————————————————————————————————————————————————————————*/
  959. /*     These flags can be passed into 'value' field on creation of the control.            */
  960. /*     Value is set to 0 after control is created.                                            */
  961. /*                                                                                        */
  962. /*    The kClockIsLive value tells the clock to automatically update on idle (clock will    */
  963. /*    have the current time). This flag is only valid when the kClockIsDisplayOnly flag    */
  964. /*    is set.                                                                                */
  965. /*——————————————————————————————————————————————————————————————————————————————————————*/
  966.  
  967. enum {
  968.     kControlClockNoFlags        = 0,
  969.     kControlClockIsDisplayOnly    = 1,
  970.     kControlClockIsLive            = 2
  971. };
  972.  
  973.  
  974. enum {
  975.                                                                 /* Tagged data supported by clocks */
  976.     kControlClockLongDateTag    = FOUR_CHAR_CODE('date'),        /* LongDateRec*/
  977.     kControlClockFontStyleTag    = kControlFontStyleTag            /* ControlFontStyleRec*/
  978. };
  979.  
  980. /*——————————————————————————————————————————————————————————————————————————————————————*/
  981. /*    • USER PANE (CDEF 16)                                                                */
  982. /*——————————————————————————————————————————————————————————————————————————————————————*/
  983.  
  984. enum {
  985.                                                                 /* User Pane proc IDs */
  986.     kControlUserPaneProc        = 256
  987. };
  988.  
  989. /* Tagged data supported by user panes */
  990. /* Currently, they are all proc ptrs for doing things like drawing and hit testing, etc. */
  991.  
  992. enum {
  993.     kControlUserItemDrawProcTag    = FOUR_CHAR_CODE('uidp'),        /* UserItemUPP*/
  994.     kControlUserPaneDrawProcTag    = FOUR_CHAR_CODE('draw'),        /* ControlUserPaneDrawingUPP*/
  995.     kControlUserPaneHitTestProcTag = FOUR_CHAR_CODE('hitt'),    /* ControlUserPaneHitTestUPP*/
  996.     kControlUserPaneTrackingProcTag = FOUR_CHAR_CODE('trak'),    /* ControlUserPaneTrackingUPP*/
  997.     kControlUserPaneIdleProcTag    = FOUR_CHAR_CODE('idle'),        /* ControlUserPaneIdleUPP*/
  998.     kControlUserPaneKeyDownProcTag = FOUR_CHAR_CODE('keyd'),    /* ControlUserPaneKeyDownUPP*/
  999.     kControlUserPaneActivateProcTag = FOUR_CHAR_CODE('acti'),    /* ControlUserPaneActivateUPP*/
  1000.     kControlUserPaneFocusProcTag = FOUR_CHAR_CODE('foci'),        /* ControlUserPaneFocusUPP*/
  1001.     kControlUserPaneBackgroundProcTag = FOUR_CHAR_CODE('back')    /* ControlUserPaneBackgroundUPP*/
  1002. };
  1003.  
  1004. typedef CALLBACK_API( void , ControlUserPaneDrawProcPtr )(ControlHandle control, SInt16 part);
  1005. typedef CALLBACK_API( ControlPartCode , ControlUserPaneHitTestProcPtr )(ControlHandle control, Point where);
  1006. typedef CALLBACK_API( ControlPartCode , ControlUserPaneTrackingProcPtr )(ControlHandle control, Point startPt, ControlActionUPP actionProc);
  1007. typedef CALLBACK_API( void , ControlUserPaneIdleProcPtr )(ControlHandle control);
  1008. typedef CALLBACK_API( ControlPartCode , ControlUserPaneKeyDownProcPtr )(ControlHandle control, SInt16 keyCode, SInt16 charCode, SInt16 modifiers);
  1009. typedef CALLBACK_API( void , ControlUserPaneActivateProcPtr )(ControlHandle control, Boolean activating);
  1010. typedef CALLBACK_API( ControlPartCode , ControlUserPaneFocusProcPtr )(ControlHandle control, ControlFocusPart action);
  1011. typedef CALLBACK_API( void , ControlUserPaneBackgroundProcPtr )(ControlHandle control, ControlBackgroundPtr info);
  1012. typedef STACK_UPP_TYPE(ControlUserPaneDrawProcPtr)                 ControlUserPaneDrawUPP;
  1013. typedef STACK_UPP_TYPE(ControlUserPaneHitTestProcPtr)             ControlUserPaneHitTestUPP;
  1014. typedef STACK_UPP_TYPE(ControlUserPaneTrackingProcPtr)             ControlUserPaneTrackingUPP;
  1015. typedef STACK_UPP_TYPE(ControlUserPaneIdleProcPtr)                 ControlUserPaneIdleUPP;
  1016. typedef STACK_UPP_TYPE(ControlUserPaneKeyDownProcPtr)             ControlUserPaneKeyDownUPP;
  1017. typedef STACK_UPP_TYPE(ControlUserPaneActivateProcPtr)             ControlUserPaneActivateUPP;
  1018. typedef STACK_UPP_TYPE(ControlUserPaneFocusProcPtr)             ControlUserPaneFocusUPP;
  1019. typedef STACK_UPP_TYPE(ControlUserPaneBackgroundProcPtr)         ControlUserPaneBackgroundUPP;
  1020. enum { uppControlUserPaneDrawProcInfo = 0x000002C0 };             /* pascal no_return_value Func(4_bytes, 2_bytes) */
  1021. enum { uppControlUserPaneHitTestProcInfo = 0x000003E0 };         /* pascal 2_bytes Func(4_bytes, 4_bytes) */
  1022. enum { uppControlUserPaneTrackingProcInfo = 0x00000FE0 };         /* pascal 2_bytes Func(4_bytes, 4_bytes, 4_bytes) */
  1023. enum { uppControlUserPaneIdleProcInfo = 0x000000C0 };             /* pascal no_return_value Func(4_bytes) */
  1024. enum { uppControlUserPaneKeyDownProcInfo = 0x00002AE0 };         /* pascal 2_bytes Func(4_bytes, 2_bytes, 2_bytes, 2_bytes) */
  1025. enum { uppControlUserPaneActivateProcInfo = 0x000001C0 };         /* pascal no_return_value Func(4_bytes, 1_byte) */
  1026. enum { uppControlUserPaneFocusProcInfo = 0x000002E0 };             /* pascal 2_bytes Func(4_bytes, 2_bytes) */
  1027. enum { uppControlUserPaneBackgroundProcInfo = 0x000003C0 };     /* pascal no_return_value Func(4_bytes, 4_bytes) */
  1028. #define NewControlUserPaneDrawProc(userRoutine)                 (ControlUserPaneDrawUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlUserPaneDrawProcInfo, GetCurrentArchitecture())
  1029. #define NewControlUserPaneHitTestProc(userRoutine)                 (ControlUserPaneHitTestUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlUserPaneHitTestProcInfo, GetCurrentArchitecture())
  1030. #define NewControlUserPaneTrackingProc(userRoutine)             (ControlUserPaneTrackingUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlUserPaneTrackingProcInfo, GetCurrentArchitecture())
  1031. #define NewControlUserPaneIdleProc(userRoutine)                 (ControlUserPaneIdleUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlUserPaneIdleProcInfo, GetCurrentArchitecture())
  1032. #define NewControlUserPaneKeyDownProc(userRoutine)                 (ControlUserPaneKeyDownUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlUserPaneKeyDownProcInfo, GetCurrentArchitecture())
  1033. #define NewControlUserPaneActivateProc(userRoutine)             (ControlUserPaneActivateUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlUserPaneActivateProcInfo, GetCurrentArchitecture())
  1034. #define NewControlUserPaneFocusProc(userRoutine)                 (ControlUserPaneFocusUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlUserPaneFocusProcInfo, GetCurrentArchitecture())
  1035. #define NewControlUserPaneBackgroundProc(userRoutine)             (ControlUserPaneBackgroundUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlUserPaneBackgroundProcInfo, GetCurrentArchitecture())
  1036. #define CallControlUserPaneDrawProc(userRoutine, control, part)  CALL_TWO_PARAMETER_UPP((userRoutine), uppControlUserPaneDrawProcInfo, (control), (part))
  1037. #define CallControlUserPaneHitTestProc(userRoutine, control, where)  CALL_TWO_PARAMETER_UPP((userRoutine), uppControlUserPaneHitTestProcInfo, (control), (where))
  1038. #define CallControlUserPaneTrackingProc(userRoutine, control, startPt, actionProc)  CALL_THREE_PARAMETER_UPP((userRoutine), uppControlUserPaneTrackingProcInfo, (control), (startPt), (actionProc))
  1039. #define CallControlUserPaneIdleProc(userRoutine, control)         CALL_ONE_PARAMETER_UPP((userRoutine), uppControlUserPaneIdleProcInfo, (control))
  1040. #define CallControlUserPaneKeyDownProc(userRoutine, control, keyCode, charCode, modifiers)  CALL_FOUR_PARAMETER_UPP((userRoutine), uppControlUserPaneKeyDownProcInfo, (control), (keyCode), (charCode), (modifiers))
  1041. #define CallControlUserPaneActivateProc(userRoutine, control, activating)  CALL_TWO_PARAMETER_UPP((userRoutine), uppControlUserPaneActivateProcInfo, (control), (activating))
  1042. #define CallControlUserPaneFocusProc(userRoutine, control, action)  CALL_TWO_PARAMETER_UPP((userRoutine), uppControlUserPaneFocusProcInfo, (control), (action))
  1043. #define CallControlUserPaneBackgroundProc(userRoutine, control, info)  CALL_TWO_PARAMETER_UPP((userRoutine), uppControlUserPaneBackgroundProcInfo, (control), (info))
  1044. /*
  1045.   ——————————————————————————————————————————————————————————————————————————————————————————
  1046.       • EDIT TEXT (CDEF 17)
  1047.   ——————————————————————————————————————————————————————————————————————————————————————————
  1048. */
  1049.  
  1050. enum {
  1051.                                                                 /* Edit Text proc IDs */
  1052.     kControlEditTextProc        = 272,
  1053.     kControlEditTextDialogProc    = 273,
  1054.     kControlEditTextPasswordProc = 274,
  1055.     kControlEditTextDialogPasswordProc = 275
  1056. };
  1057.  
  1058.  
  1059. enum {
  1060.                                                                 /* Tagged data supported by edit text */
  1061.     kControlEditTextStyleTag    = kControlFontStyleTag,            /* ControlFontStyleRec*/
  1062.     kControlEditTextTextTag        = FOUR_CHAR_CODE('text'),        /* Buffer of chars - you supply the buffer*/
  1063.     kControlEditTextTEHandleTag    = FOUR_CHAR_CODE('than'),        /* The TEHandle of the text edit record*/
  1064.     kControlEditTextKeyFilterTag = kControlKeyFilterTag,
  1065.     kControlEditTextSelectionTag = FOUR_CHAR_CODE('sele'),        /* EditTextSelectionRec*/
  1066.     kControlEditTextPasswordTag    = FOUR_CHAR_CODE('pass')        /* The clear text password text*/
  1067. };
  1068.  
  1069.  
  1070. struct ControlEditTextSelectionRec {
  1071.                                                                 /* Structure for getting the edit text selection */
  1072.     SInt16                             selStart;
  1073.     SInt16                             selEnd;
  1074. };
  1075. typedef struct ControlEditTextSelectionRec ControlEditTextSelectionRec;
  1076.  
  1077. typedef ControlEditTextSelectionRec *    ControlEditTextSelectionPtr;
  1078. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1079. /*    • STATIC TEXT (CDEF 18)                                                                */
  1080. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1081. /* Static Text proc IDs */
  1082.  
  1083. enum {
  1084.     kControlStaticTextProc        = 288
  1085. };
  1086.  
  1087. /* Tagged data supported by static text */
  1088.  
  1089. enum {
  1090.     kControlStaticTextStyleTag    = kControlFontStyleTag,            /* ControlFontStyleRec*/
  1091.     kControlStaticTextTextTag    = FOUR_CHAR_CODE('text'),        /* Copy of text*/
  1092.     kControlStaticTextTextHeightTag = FOUR_CHAR_CODE('thei')    /* SInt16*/
  1093. };
  1094.  
  1095. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1096. /*    • PICTURE CONTROL (CDEF 19)                                                            */
  1097. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1098. /*    Value parameter should contain the ID of the picture you wish to display when        */
  1099. /*    creating controls of this type. If you don't want the control tracked at all, use     */
  1100. /*    the 'no track' variant.                                                                */
  1101.  
  1102. enum {
  1103.                                                                 /* Picture control proc IDs */
  1104.     kControlPictureProc            = 304,
  1105.     kControlPictureNoTrackProc    = 305                            /* immediately returns kControlPicturePart*/
  1106. };
  1107.  
  1108. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1109. /*    • ICON CONTROL (CDEF 20)                                                            */
  1110. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1111. /*    Value parameter should contain the ID of the ICON or cicn you wish to display when    */
  1112. /*    creating controls of this type. If you don't want the control tracked at all, use     */
  1113. /*    the 'no track' variant.                                                                */
  1114. /* Icon control proc IDs */
  1115.  
  1116. enum {
  1117.     kControlIconProc            = 320,
  1118.     kControlIconNoTrackProc        = 321,                            /* immediately returns kControlIconPart*/
  1119.     kControlIconSuiteProc        = 322,
  1120.     kControlIconSuiteNoTrackProc = 323                            /* immediately returns kControlIconPart*/
  1121. };
  1122.  
  1123. /* Tagged data supported by icon controls */
  1124.  
  1125. enum {
  1126.     kControlIconTransformTag    = FOUR_CHAR_CODE('trfm'),        /* IconTransformType*/
  1127.     kControlIconAlignmentTag    = FOUR_CHAR_CODE('algn')        /* IconAlignmentType*/
  1128. };
  1129.  
  1130. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1131. /*    • WINDOW HEADER (CDEF 21)                                                            */
  1132. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1133.  
  1134. enum {
  1135.                                                                 /* Window Header proc IDs */
  1136.     kControlWindowHeaderProc    = 336,                            /* normal header*/
  1137.     kControlWindowListViewHeaderProc = 337                        /* variant for list views - no bottom line*/
  1138. };
  1139.  
  1140. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1141. /*    • LIST BOX (CDEF 22)                                                                */
  1142. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1143. /*    Lists use an auxiliary resource to define their format. The resource type used is     */
  1144. /*    'ldes' and a definition for it can be found in Appearance.r. The resource ID for     */
  1145. /*    the ldes is passed in the 'value' parameter when creating the control. You may pass */
  1146. /*    zero in value. This tells the List Box control to not use a resource. The list will */
  1147. /*    be created with default values, and will use the standard LDEF (0). You can change    */
  1148. /*    the list by getting the list handle. You can set the LDEF to use by using the tag    */
  1149. /*    below (kControlListBoxLDEFTag)                                                        */
  1150.  
  1151. enum {
  1152.                                                                 /* List Box proc IDs */
  1153.     kControlListBoxProc            = 352,
  1154.     kControlListBoxAutoSizeProc    = 353
  1155. };
  1156.  
  1157.  
  1158. enum {
  1159.                                                                 /* Tagged data supported by list box */
  1160.     kControlListBoxListHandleTag = FOUR_CHAR_CODE('lhan'),        /* ListHandle*/
  1161.     kControlListBoxKeyFilterTag    = kControlKeyFilterTag,            /* ControlKeyFilterUPP*/
  1162.     kControlListBoxFontStyleTag    = kControlFontStyleTag            /* ControlFontStyleRec*/
  1163. };
  1164.  
  1165. /* New tags in 1.0.1 or later */
  1166.  
  1167. enum {
  1168.     kControlListBoxDoubleClickTag = FOUR_CHAR_CODE('dblc'),        /* Boolean. Was last click a double-click?*/
  1169.     kControlListBoxLDEFTag        = FOUR_CHAR_CODE('ldef')        /* SInt16. ID of LDEF to use. */
  1170. };
  1171.  
  1172. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1173. /*    • PUSH BUTTON (CDEF 23)                                                                */
  1174. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1175. /*    The new standard checkbox and radio button controls support a "mixed" value that    */
  1176. /*    indicates that the current setting contains a mixed set of on and off values. The     */
  1177. /*    control value used to display this indication is defined in Controls.h:                */
  1178. /*                                                                                        */
  1179. /*        kControlCheckBoxMixedValue = 2                                                    */
  1180. /*                                                                                        */
  1181. /*    Two new variants of the standard pushbutton have been added to the standard control    */
  1182. /*    suite that draw a color icon next to the control title. One variant draws the icon    */
  1183. /*    on the left side, the other draws it on the right side (when the system justifica-    */
  1184. /*    tion is right to left, these are reversed).                                            */
  1185. /*                                                                                        */
  1186. /*    When either of the icon pushbuttons are created, the contrlMax field of the control */
  1187. /*    record is used to determine the ID of the 'cicn' resource drawn in the pushbutton.    */
  1188. /*                                                                                        */
  1189. /*    In addition, a push button can now be told to draw with a default outline using the    */
  1190. /*    SetControlData routine with the kPushButtonDefaultTag below.                        */
  1191. /*                                                                                        */
  1192.  
  1193. enum {
  1194.                                                                 /* Theme Push Button/Check Box/Radio Button proc IDs */
  1195.     kControlPushButtonProc        = 368,
  1196.     kControlCheckBoxProc        = 369,
  1197.     kControlRadioButtonProc        = 370,
  1198.     kControlPushButLeftIconProc    = 374,                            /* Standard pushbutton with left-side icon*/
  1199.     kControlPushButRightIconProc = 375                            /* Standard pushbutton with right-side icon*/
  1200. };
  1201.  
  1202.  
  1203. enum {
  1204.                                                                 /* Tagged data supported by standard buttons */
  1205.     kControlPushButtonDefaultTag = FOUR_CHAR_CODE('dflt')        /* default ring flag*/
  1206. };
  1207.  
  1208. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1209. /*    • SCROLL BAR (CDEF 24)                                                                */
  1210. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1211. /*    This is the new Appearance scroll bar.                                                */
  1212. /*                                                                                        */
  1213.  
  1214. enum {
  1215.                                                                 /* Theme Scroll Bar proc IDs */
  1216.     kControlScrollBarProc        = 384,                            /* normal scroll bar*/
  1217.     kControlScrollBarLiveProc    = 386                            /* live scrolling variant*/
  1218. };
  1219.  
  1220. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1221. /*    • POPUP BUTTON (CDEF 25)                                                            */
  1222. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1223. /*    This is the new Appearance Popup Button. It takes the same variants and does the     */
  1224. /*    same overloading as the previous popup menu control. There are some differences:    */
  1225. /*                                                                                        */
  1226. /*    Passing in a menu ID of -12345 causes the popup not to try and get the menu from a    */
  1227. /*    resource. Instead, you can build the menu and later stuff the menuhandle field in     */
  1228. /*    the popup data information.                                                            */
  1229. /*                                                                                        */
  1230. /*    You can pass -1 in the Max parameter to have the control calculate the width of the    */
  1231. /*    title on its own instead of guessing and then tweaking to get it right. It adds the    */
  1232. /*    appropriate amount of space between the title and the popup.                        */
  1233. /*                                                                                        */
  1234.  
  1235. enum {
  1236.                                                                 /* Theme Popup Button proc IDs */
  1237.     kControlPopupButtonProc        = 400,
  1238.     kControlPopupFixedWidthVariant = 1 << 0,
  1239.     kControlPopupVariableWidthVariant = 1 << 1,
  1240.     kControlPopupUseAddResMenuVariant = 1 << 2,
  1241.     kControlPopupUseWFontVariant = 1 << 3                        /* kControlUsesOwningWindowsFontVariant*/
  1242. };
  1243.  
  1244. /* These tags are available in 1.0.1 or later of Appearance */
  1245.  
  1246. enum {
  1247.     kControlPopupButtonMenuHandleTag = FOUR_CHAR_CODE('mhan'),    /* MenuHandle*/
  1248.     kControlPopupButtonMenuIDTag = FOUR_CHAR_CODE('mnid')        /* SInt16*/
  1249. };
  1250.  
  1251. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1252. /*    • RADIO GROUP (CDEF 26)                                                                */
  1253. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1254. /*    This control implements a radio group. It is an embedding control and can therefore    */
  1255. /*     only be used when a control hierarchy is established for its owning window. You        */
  1256. /*    should only embed radio buttons within it. As radio buttons are embedded into it,    */
  1257. /*    the group sets up its value, min, and max to represent the number of embedded items.*/
  1258. /*    The current value of the control is the index of the sub-control that is the current*/
  1259. /*    'on' radio button. To get the current radio button control handle, you can use the    */
  1260. /*    control manager call GetIndSubControl, passing in the value of the radio group.        */
  1261. /*                                                                                        */
  1262. /*    NOTE: This control is only available with Appearance 1.0.1.                            */
  1263.  
  1264. enum {
  1265.     kControlRadioGroupProc        = 416
  1266. };
  1267.  
  1268.  
  1269. /*  —— end of stuff only available with Appearance 1.0 and later*/
  1270.  
  1271.  
  1272. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1273. /*    • Control Variants                                                                    */
  1274. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1275. typedef SInt16                             ControlVariant;
  1276.  
  1277. enum {
  1278.     kControlNoVariant            = 0,                            /* No variant*/
  1279.     kControlUsesOwningWindowsFontVariant = 1 << 3                /* Control uses owning windows font to display text*/
  1280. };
  1281.  
  1282. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1283. /*    • Control Part Codes                                                                */
  1284. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1285.  
  1286. enum {
  1287.     kControlNoPart                = 0,
  1288.     kControlLabelPart            = 1,
  1289.     kControlMenuPart            = 2,
  1290.     kControlTrianglePart        = 4,
  1291.     kControlEditTextPart        = 5,                            /* Appearance 1.0 and later*/
  1292.     kControlPicturePart            = 6,                            /* Appearance 1.0 and later*/
  1293.     kControlIconPart            = 7,                            /* Appearance 1.0 and later*/
  1294.     kControlClockPart            = 8,                            /* Appearance 1.0 and later*/
  1295.     kControlListBoxPart            = 24,                            /* Appearance 1.0 and later*/
  1296.     kControlListBoxDoubleClickPart = 25,                        /* Appearance 1.0 and later*/
  1297.     kControlImageWellPart        = 26,                            /* Appearance 1.0 and later*/
  1298.     kControlRadioGroupPart        = 27,                            /* Appearance 1.1 and later*/
  1299.     kControlButtonPart            = 10,
  1300.     kControlCheckBoxPart        = 11,
  1301.     kControlRadioButtonPart        = 11,
  1302.     kControlUpButtonPart        = 20,
  1303.     kControlDownButtonPart        = 21,
  1304.     kControlPageUpPart            = 22,
  1305.     kControlPageDownPart        = 23,
  1306.     kControlIndicatorPart        = 129,
  1307.     kControlDisabledPart        = 254,
  1308.     kControlInactivePart        = 255
  1309. };
  1310.  
  1311. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1312. /*    • Check Box Values                                                                    */
  1313. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1314.  
  1315. enum {
  1316.     kControlCheckBoxUncheckedValue = 0,
  1317.     kControlCheckBoxCheckedValue = 1,
  1318.     kControlCheckBoxMixedValue    = 2
  1319. };
  1320.  
  1321. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1322. /*    • Radio Button Values                                                                */
  1323. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1324.  
  1325. enum {
  1326.     kControlRadioButtonUncheckedValue = 0,
  1327.     kControlRadioButtonCheckedValue = 1,
  1328.     kControlRadioButtonMixedValue = 2
  1329. };
  1330.  
  1331. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1332. /*    • Pop-Up Menu Control Constants                                                        */
  1333. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1334. /* Variant codes for the System 7 pop-up menu*/
  1335.  
  1336. enum {
  1337.     popupFixedWidth                = 1 << 0,
  1338.     popupVariableWidth            = 1 << 1,
  1339.     popupUseAddResMenu            = 1 << 2,
  1340.     popupUseWFont                = 1 << 3
  1341. };
  1342.  
  1343. /* Menu label styles for the System 7 pop-up menu */
  1344.  
  1345. enum {
  1346.     popupTitleBold                = 1 << 8,
  1347.     popupTitleItalic            = 1 << 9,
  1348.     popupTitleUnderline            = 1 << 10,
  1349.     popupTitleOutline            = 1 << 11,
  1350.     popupTitleShadow            = 1 << 12,
  1351.     popupTitleCondense            = 1 << 13,
  1352.     popupTitleExtend            = 1 << 14,
  1353.     popupTitleNoStyle            = 1 << 15
  1354. };
  1355.  
  1356. /* Menu label justifications for the System 7 pop-up menu*/
  1357.  
  1358. enum {
  1359.     popupTitleLeftJust            = 0x00000000,
  1360.     popupTitleCenterJust        = 0x00000001,
  1361.     popupTitleRightJust            = 0x000000FF
  1362. };
  1363.  
  1364. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1365. /*     • DragGrayRgn Constatns                                                                */
  1366. /*                                                                                        */
  1367. /*   For DragGrayRgnUPP used in TrackControl()                                             */
  1368. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1369.  
  1370. enum {
  1371.     noConstraint                = kNoConstraint,
  1372.     hAxisOnly                    = 1,
  1373.     vAxisOnly                    = 2
  1374. };
  1375.  
  1376. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1377. /*    • Control Creation/Deletion                                                            */
  1378. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1379. EXTERN_API( ControlHandle )
  1380. NewControl                        (WindowPtr                 owningWindow,
  1381.                                  const Rect *            boundsRect,
  1382.                                  ConstStr255Param         controlTitle,
  1383.                                  Boolean                 initiallyVisible,
  1384.                                  SInt16                 initialValue,
  1385.                                  SInt16                 minimumValue,
  1386.                                  SInt16                 maximumValue,
  1387.                                  SInt16                 procID,
  1388.                                  SInt32                 controlReference)                    ONEWORDINLINE(0xA954);
  1389.  
  1390. EXTERN_API( ControlHandle )
  1391. GetNewControl                    (SInt16                 resourceID,
  1392.                                  WindowPtr                 owningWindow)                        ONEWORDINLINE(0xA9BE);
  1393.  
  1394. EXTERN_API( void )
  1395. DisposeControl                    (ControlHandle             theControl)                            ONEWORDINLINE(0xA955);
  1396.  
  1397. EXTERN_API( void )
  1398. KillControls                    (WindowPtr                 theWindow)                            ONEWORDINLINE(0xA956);
  1399.  
  1400. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1401. /*    • Control Visible State                                                                */
  1402. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1403. EXTERN_API( void )
  1404. HiliteControl                    (ControlHandle             theControl,
  1405.                                  ControlPartCode         hiliteState)                        ONEWORDINLINE(0xA95D);
  1406.  
  1407. EXTERN_API( void )
  1408. ShowControl                        (ControlHandle             theControl)                            ONEWORDINLINE(0xA957);
  1409.  
  1410. EXTERN_API( void )
  1411. HideControl                        (ControlHandle             theControl)                            ONEWORDINLINE(0xA958);
  1412.  
  1413.  
  1414. /* following state routines available only with Appearance 1.0 and later*/
  1415. EXTERN_API( Boolean )
  1416. IsControlActive                    (ControlHandle             inControl)                            THREEWORDINLINE(0x303C, 0x0005, 0xAA73);
  1417.  
  1418. EXTERN_API( Boolean )
  1419. IsControlVisible                (ControlHandle             inControl)                            THREEWORDINLINE(0x303C, 0x0006, 0xAA73);
  1420.  
  1421. EXTERN_API( OSErr )
  1422. ActivateControl                    (ControlHandle             inControl)                            THREEWORDINLINE(0x303C, 0x0007, 0xAA73);
  1423.  
  1424. EXTERN_API( OSErr )
  1425. DeactivateControl                (ControlHandle             inControl)                            THREEWORDINLINE(0x303C, 0x0008, 0xAA73);
  1426.  
  1427. EXTERN_API( OSErr )
  1428. SetControlVisibility            (ControlHandle             inControl,
  1429.                                  Boolean                 inIsVisible,
  1430.                                  Boolean                 inDoDraw)                            THREEWORDINLINE(0x303C, 0x001E, 0xAA73);
  1431.  
  1432.  
  1433. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1434. /*    • Control Imaging                                                                    */
  1435. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1436. EXTERN_API( void )
  1437. DrawControls                    (WindowPtr                 theWindow)                            ONEWORDINLINE(0xA969);
  1438.  
  1439. EXTERN_API( void )
  1440. Draw1Control                    (ControlHandle             theControl)                            ONEWORDINLINE(0xA96D);
  1441.  
  1442. #define DrawOneControl(theControl) Draw1Control(theControl)
  1443.  
  1444. EXTERN_API( void )
  1445. UpdateControls                    (WindowPtr                 theWindow,
  1446.                                  RgnHandle                 updateRegion)                        ONEWORDINLINE(0xA953);
  1447.  
  1448.  
  1449. /* following imaging routines available only with Appearance 1.0 and later*/
  1450. EXTERN_API( OSErr )
  1451. GetBestControlRect                (ControlHandle             inControl,
  1452.                                  Rect *                    outRect,
  1453.                                  SInt16 *                outBaseLineOffset)                    THREEWORDINLINE(0x303C, 0x001B, 0xAA73);
  1454.  
  1455. EXTERN_API( OSErr )
  1456. SetControlFontStyle                (ControlHandle             inControl,
  1457.                                  const ControlFontStyleRec * inStyle)                        THREEWORDINLINE(0x303C, 0x001C, 0xAA73);
  1458.  
  1459. EXTERN_API( void )
  1460. DrawControlInCurrentPort        (ControlHandle             inControl)                            THREEWORDINLINE(0x303C, 0x0018, 0xAA73);
  1461.  
  1462. EXTERN_API( OSErr )
  1463. SetUpControlBackground            (ControlHandle             inControl,
  1464.                                  SInt16                 inDepth,
  1465.                                  Boolean                 inIsColorDevice)                    THREEWORDINLINE(0x303C, 0x001D, 0xAA73);
  1466.  
  1467. /* SetUpControlTextColor is available in Appearance 1.1 or later.*/
  1468. EXTERN_API( OSErr )
  1469. SetUpControlTextColor            (ControlHandle             inControl,
  1470.                                  SInt16                 inDepth,
  1471.                                  Boolean                 inIsColorDevice);
  1472.  
  1473.  
  1474. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1475. /*    • Control Mousing                                                                    */
  1476. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1477. /*
  1478.     NOTE ON CONTROL ACTION PROCS
  1479.     
  1480.     When using the TrackControl() call when tracking an indicator, the actionProc parameter
  1481.     (type ControlActionUPP) should be replaced by a parameter of type DragGrayRgnUPP
  1482.     (see Quickdraw.h).
  1483.     
  1484.     If, however, you are using the live feedback variants of scroll bars or sliders, you
  1485.     can pass a ControlActionUPP in when tracking the indicator as well. This functionality
  1486.     is available in Appearance 1.0 or later.
  1487. */
  1488. EXTERN_API( ControlPartCode )
  1489. TrackControl                    (ControlHandle             theControl,
  1490.                                  Point                     startPoint,
  1491.                                  ControlActionUPP         actionProc)                            ONEWORDINLINE(0xA968);
  1492.  
  1493. EXTERN_API( void )
  1494. DragControl                        (ControlHandle             theControl,
  1495.                                  Point                     startPoint,
  1496.                                  const Rect *            limitRect,
  1497.                                  const Rect *            slopRect,
  1498.                                  DragConstraint         axis)                                ONEWORDINLINE(0xA967);
  1499.  
  1500. EXTERN_API( ControlPartCode )
  1501. TestControl                        (ControlHandle             theControl,
  1502.                                  Point                     testPoint)                            ONEWORDINLINE(0xA966);
  1503.  
  1504. EXTERN_API( ControlPartCode )
  1505. FindControl                        (Point                     testPoint,
  1506.                                  WindowPtr                 theWindow,
  1507.                                  ControlHandle *        theControl)                            ONEWORDINLINE(0xA96C);
  1508.  
  1509. /* The following mousing routines available only with Appearance 1.0 and later    */
  1510. /*                                                                                */
  1511. /* FindControlUnderMouse is preferrable to TrackControl when running under        */
  1512. /* Appearance 1.0 as you can pass in modifiers, which some of the new controls    */
  1513. /* use, such as edit text and list boxes.                                        */
  1514. EXTERN_API( ControlHandle )
  1515. FindControlUnderMouse            (Point                     inWhere,
  1516.                                  WindowPtr                 inWindow,
  1517.                                  SInt16 *                outPart)                            THREEWORDINLINE(0x303C, 0x0009, 0xAA73);
  1518.  
  1519. EXTERN_API( SInt16 )
  1520. HandleControlClick                (ControlHandle             inControl,
  1521.                                  Point                     inWhere,
  1522.                                  SInt16                 inModifiers,
  1523.                                  ControlActionUPP         inAction)                            THREEWORDINLINE(0x303C, 0x000A, 0xAA73);
  1524.  
  1525.  
  1526.  
  1527.  
  1528. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1529. /*    • Control Events (available only with Appearance 1.0 and later)                        */
  1530. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1531. EXTERN_API( SInt16 )
  1532. HandleControlKey                (ControlHandle             inControl,
  1533.                                  SInt16                 inKeyCode,
  1534.                                  SInt16                 inCharCode,
  1535.                                  SInt16                 inModifiers)                        THREEWORDINLINE(0x303C, 0x000B, 0xAA73);
  1536.  
  1537. EXTERN_API( void )
  1538. IdleControls                    (WindowPtr                 inWindow)                            THREEWORDINLINE(0x303C, 0x000C, 0xAA73);
  1539.  
  1540.  
  1541.  
  1542. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1543. /*    • Control Positioning                                                                */
  1544. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1545. EXTERN_API( void )
  1546. MoveControl                        (ControlHandle             theControl,
  1547.                                  SInt16                 h,
  1548.                                  SInt16                 v)                                    ONEWORDINLINE(0xA959);
  1549.  
  1550. EXTERN_API( void )
  1551. SizeControl                        (ControlHandle             theControl,
  1552.                                  SInt16                 w,
  1553.                                  SInt16                 h)                                    ONEWORDINLINE(0xA95C);
  1554.  
  1555. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1556. /*    • Control Title                                                                        */
  1557. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1558. EXTERN_API( void )
  1559. SetControlTitle                    (ControlHandle             theControl,
  1560.                                  ConstStr255Param         title)                                ONEWORDINLINE(0xA95F);
  1561.  
  1562. EXTERN_API( void )
  1563. GetControlTitle                    (ControlHandle             theControl,
  1564.                                  Str255                 title)                                ONEWORDINLINE(0xA95E);
  1565.  
  1566. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1567. /*    • Control Value                                                                        */
  1568. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1569. EXTERN_API( SInt16 )
  1570. GetControlValue                    (ControlHandle             theControl)                            ONEWORDINLINE(0xA960);
  1571.  
  1572. EXTERN_API( void )
  1573. SetControlValue                    (ControlHandle             theControl,
  1574.                                  SInt16                 newValue)                            ONEWORDINLINE(0xA963);
  1575.  
  1576. EXTERN_API( SInt16 )
  1577. GetControlMinimum                (ControlHandle             theControl)                            ONEWORDINLINE(0xA961);
  1578.  
  1579. EXTERN_API( void )
  1580. SetControlMinimum                (ControlHandle             theControl,
  1581.                                  SInt16                 newMinimum)                            ONEWORDINLINE(0xA964);
  1582.  
  1583. EXTERN_API( SInt16 )
  1584. GetControlMaximum                (ControlHandle             theControl)                            ONEWORDINLINE(0xA962);
  1585.  
  1586. EXTERN_API( void )
  1587. SetControlMaximum                (ControlHandle             theControl,
  1588.                                  SInt16                 newMaximum)                            ONEWORDINLINE(0xA965);
  1589.  
  1590. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1591. /*    • Control Variant                                                                    */
  1592. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1593. EXTERN_API( ControlVariant )
  1594. GetControlVariant                (ControlHandle             theControl)                            ONEWORDINLINE(0xA809);
  1595.  
  1596. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1597. /*    • Control Action                                                                    */
  1598. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1599. EXTERN_API( void )
  1600. SetControlAction                (ControlHandle             theControl,
  1601.                                  ControlActionUPP         actionProc)                            ONEWORDINLINE(0xA96B);
  1602.  
  1603. EXTERN_API( ControlActionUPP )
  1604. GetControlAction                (ControlHandle             theControl)                            ONEWORDINLINE(0xA96A);
  1605.  
  1606. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1607. /* • Control Accessors                                                                    */
  1608. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1609. EXTERN_API( void )
  1610. SetControlReference                (ControlHandle             theControl,
  1611.                                  SInt32                 data)                                ONEWORDINLINE(0xA95B);
  1612.  
  1613. EXTERN_API( SInt32 )
  1614. GetControlReference                (ControlHandle             theControl)                            ONEWORDINLINE(0xA95A);
  1615.  
  1616. EXTERN_API( Boolean )
  1617. GetAuxiliaryControlRecord        (ControlHandle             theControl,
  1618.                                  AuxCtlHandle *            acHndl)                                ONEWORDINLINE(0xAA44);
  1619.  
  1620. EXTERN_API( void )
  1621. SetControlColor                    (ControlHandle             theControl,
  1622.                                  CCTabHandle             newColorTable)                        ONEWORDINLINE(0xAA43);
  1623.  
  1624. #define GetControlListFromWindow(theWindow)        ( *(ControlHandle *) (((UInt8 *) theWindow) + sizeof(GrafPort) + 0x20))
  1625. #define GetControlOwningWindowControlList(theWindow)        ( *(ControlHandle *) (((UInt8 *) theWindow) + sizeof(GrafPort) + 0x20))
  1626. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1627. /*    • HELPERS (available only with Appearance 1.0 and later)                            */
  1628. /*                                                                                        */
  1629. /* These routines are available only thru the shared library/glue                        */
  1630. /* Bevel button routines                                                                */
  1631. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1632.  
  1633. EXTERN_API( OSErr )
  1634. GetBevelButtonMenuValue            (ControlHandle             inButton,
  1635.                                  SInt16 *                outValue);
  1636.  
  1637. EXTERN_API( OSErr )
  1638. SetBevelButtonMenuValue            (ControlHandle             inButton,
  1639.                                  SInt16                 inValue);
  1640.  
  1641. EXTERN_API( OSErr )
  1642. GetBevelButtonMenuHandle        (ControlHandle             inButton,
  1643.                                  MenuHandle *            outHandle);
  1644.  
  1645. EXTERN_API( OSErr )
  1646. GetBevelButtonContentInfo        (ControlHandle             inButton,
  1647.                                  ControlButtonContentInfoPtr  outContent);
  1648.  
  1649. EXTERN_API( OSErr )
  1650. SetBevelButtonContentInfo        (ControlHandle             inButton,
  1651.                                  ControlButtonContentInfoPtr  inContent);
  1652.  
  1653. EXTERN_API( OSErr )
  1654. SetBevelButtonTransform            (ControlHandle             inButton,
  1655.                                  IconTransformType         transform);
  1656.  
  1657. EXTERN_API( OSErr )
  1658. SetBevelButtonGraphicAlignment    (ControlHandle             inButton,
  1659.                                  ControlButtonGraphicAlignment  inAlign,
  1660.                                  SInt16                 inHOffset,
  1661.                                  SInt16                 inVOffset);
  1662.  
  1663. EXTERN_API( OSErr )
  1664. SetBevelButtonTextAlignment        (ControlHandle             inButton,
  1665.                                  ControlButtonTextAlignment  inAlign,
  1666.                                  SInt16                 inHOffset);
  1667.  
  1668. EXTERN_API( OSErr )
  1669. SetBevelButtonTextPlacement        (ControlHandle             inButton,
  1670.                                  ControlButtonTextPlacement  inWhere);
  1671.  
  1672. /* Image well routines*/
  1673.  
  1674. EXTERN_API( OSErr )
  1675. GetImageWellContentInfo            (ControlHandle             inButton,
  1676.                                  ControlButtonContentInfoPtr  outContent);
  1677.  
  1678. EXTERN_API( OSErr )
  1679. SetImageWellContentInfo            (ControlHandle             inButton,
  1680.                                  ControlButtonContentInfoPtr  inContent);
  1681.  
  1682. EXTERN_API( OSErr )
  1683. SetImageWellTransform            (ControlHandle             inButton,
  1684.                                  IconTransformType         inTransform);
  1685.  
  1686. /* Tab routines*/
  1687.  
  1688. EXTERN_API( OSErr )
  1689. GetTabContentRect                (ControlHandle             inTabControl,
  1690.                                  Rect *                    outContentRect);
  1691.  
  1692. EXTERN_API( OSErr )
  1693. SetTabEnabled                    (ControlHandle             inTabControl,
  1694.                                  SInt16                 inTabToHilite,
  1695.                                  Boolean                 inEnabled);
  1696.  
  1697. /* Disclosure triangles*/
  1698.  
  1699. EXTERN_API( OSErr )
  1700. SetDisclosureTriangleLastValue    (ControlHandle             inTabControl,
  1701.                                  SInt16                 inValue);
  1702.  
  1703. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1704. /*    • Control Hierarchy (Appearance 1.0 and later only)                                    */
  1705. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1706. EXTERN_API( SInt32 )
  1707. SendControlMessage                (ControlHandle             inControl,
  1708.                                  SInt16                 inMessage,
  1709.                                  SInt32                 inParam)                            THREEWORDINLINE(0x303C, 0xFFFE, 0xAA73);
  1710.  
  1711. EXTERN_API( OSErr )
  1712. DumpControlHierarchy            (WindowPtr                 inWindow,
  1713.                                  const FSSpec *            inDumpFile)                            THREEWORDINLINE(0x303C, 0xFFFF, 0xAA73);
  1714.  
  1715. EXTERN_API( OSErr )
  1716. CreateRootControl                (WindowPtr                 inWindow,
  1717.                                  ControlHandle *        outControl)                            THREEWORDINLINE(0x303C, 0x0001, 0xAA73);
  1718.  
  1719. EXTERN_API( OSErr )
  1720. GetRootControl                    (WindowPtr                 inWindow,
  1721.                                  ControlHandle *        outControl)                            THREEWORDINLINE(0x303C, 0x0002, 0xAA73);
  1722.  
  1723. EXTERN_API( OSErr )
  1724. EmbedControl                    (ControlHandle             inControl,
  1725.                                  ControlHandle             inContainer)                        THREEWORDINLINE(0x303C, 0x0003, 0xAA73);
  1726.  
  1727. EXTERN_API( OSErr )
  1728. AutoEmbedControl                (ControlHandle             inControl,
  1729.                                  WindowPtr                 inWindow)                            THREEWORDINLINE(0x303C, 0x0004, 0xAA73);
  1730.  
  1731. EXTERN_API( OSErr )
  1732. GetSuperControl                    (ControlHandle             inControl,
  1733.                                  ControlHandle *        outParent)                            THREEWORDINLINE(0x303C, 0x0015, 0xAA73);
  1734.  
  1735. EXTERN_API( OSErr )
  1736. CountSubControls                (ControlHandle             inControl,
  1737.                                  SInt16 *                outNumChildren)                        THREEWORDINLINE(0x303C, 0x0016, 0xAA73);
  1738.  
  1739. EXTERN_API( OSErr )
  1740. GetIndexedSubControl            (ControlHandle             inControl,
  1741.                                  SInt16                 inIndex,
  1742.                                  ControlHandle *        outSubControl)                        THREEWORDINLINE(0x303C, 0x0017, 0xAA73);
  1743.  
  1744. EXTERN_API( OSErr )
  1745. SetControlSupervisor            (ControlHandle             inControl,
  1746.                                  ControlHandle             inBoss)                                THREEWORDINLINE(0x303C, 0x001A, 0xAA73);
  1747.  
  1748.  
  1749.  
  1750. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1751. /*    • Keyboard Focus (available only with Appearance 1.0 and later)                        */
  1752. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1753. EXTERN_API( OSErr )
  1754. GetKeyboardFocus                (WindowPtr                 inWindow,
  1755.                                  ControlHandle *        outControl)                            THREEWORDINLINE(0x303C, 0x000D, 0xAA73);
  1756.  
  1757. EXTERN_API( OSErr )
  1758. SetKeyboardFocus                (WindowPtr                 inWindow,
  1759.                                  ControlHandle             inControl,
  1760.                                  ControlFocusPart         inPart)                                THREEWORDINLINE(0x303C, 0x000E, 0xAA73);
  1761.  
  1762. EXTERN_API( OSErr )
  1763. AdvanceKeyboardFocus            (WindowPtr                 inWindow)                            THREEWORDINLINE(0x303C, 0x000F, 0xAA73);
  1764.  
  1765. EXTERN_API( OSErr )
  1766. ReverseKeyboardFocus            (WindowPtr                 inWindow)                            THREEWORDINLINE(0x303C, 0x0010, 0xAA73);
  1767.  
  1768. EXTERN_API( OSErr )
  1769. ClearKeyboardFocus                (WindowPtr                 inWindow)                            THREEWORDINLINE(0x303C, 0x0019, 0xAA73);
  1770.  
  1771.  
  1772.  
  1773. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1774. /*    • Control Data (available only with Appearance 1.0 and later)                        */
  1775. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1776.  
  1777. EXTERN_API( OSErr )
  1778. GetControlFeatures                (ControlHandle             inControl,
  1779.                                  UInt32 *                outFeatures)                        THREEWORDINLINE(0x303C, 0x0011, 0xAA73);
  1780.  
  1781. EXTERN_API( OSErr )
  1782. SetControlData                    (ControlHandle             inControl,
  1783.                                  ControlPartCode         inPart,
  1784.                                  ResType                 inTagName,
  1785.                                  Size                     inSize,
  1786.                                  Ptr                     inData)                                THREEWORDINLINE(0x303C, 0x0012, 0xAA73);
  1787.  
  1788. EXTERN_API( OSErr )
  1789. GetControlData                    (ControlHandle             inControl,
  1790.                                  ControlPartCode         inPart,
  1791.                                  ResType                 inTagName,
  1792.                                  Size                     inBufferSize,
  1793.                                  Ptr                     inBuffer,
  1794.                                  Size *                    outActualSize)                        THREEWORDINLINE(0x303C, 0x0013, 0xAA73);
  1795.  
  1796. EXTERN_API( OSErr )
  1797. GetControlDataSize                (ControlHandle             inControl,
  1798.                                  ControlPartCode         inPart,
  1799.                                  ResType                 inTagName,
  1800.                                  Size *                    outMaxSize)                            THREEWORDINLINE(0x303C, 0x0014, 0xAA73);
  1801.  
  1802.  
  1803.  
  1804.  
  1805. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1806. /*    • ‘CDEF’ messages                                                                    */
  1807. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1808. typedef SInt16                             ControlDefProcMessage;
  1809.  
  1810. enum {
  1811.     drawCntl                    = 0,
  1812.     testCntl                    = 1,
  1813.     calcCRgns                    = 2,
  1814.     initCntl                    = 3,
  1815.     dispCntl                    = 4,
  1816.     posCntl                        = 5,
  1817.     thumbCntl                    = 6,
  1818.     dragCntl                    = 7,
  1819.     autoTrack                    = 8,
  1820.     calcCntlRgn                    = 10,
  1821.     calcThumbRgn                = 11,
  1822.     drawThumbOutline            = 12
  1823. };
  1824.  
  1825. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1826. /*    • ‘CDEF’ entrypoint                                                                    */
  1827. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1828. typedef CALLBACK_API( SInt32 , ControlDefProcPtr )(SInt16 varCode, ControlHandle theControl, ControlDefProcMessage message, SInt32 param);
  1829. typedef STACK_UPP_TYPE(ControlDefProcPtr)                         ControlDefUPP;
  1830. enum { uppControlDefProcInfo = 0x00003BB0 };                     /* pascal 4_bytes Func(2_bytes, 4_bytes, 2_bytes, 4_bytes) */
  1831. #define NewControlDefProc(userRoutine)                             (ControlDefUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlDefProcInfo, GetCurrentArchitecture())
  1832. #define CallControlDefProc(userRoutine, varCode, theControl, message, param)  CALL_FOUR_PARAMETER_UPP((userRoutine), uppControlDefProcInfo, (varCode), (theControl), (message), (param))
  1833. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1834. /*    • Constants for drawCntl message (passed in param)                                    */
  1835. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1836.  
  1837. enum {
  1838.     kDrawControlEntireControl    = 0,
  1839.     kDrawControlIndicatorOnly    = 129
  1840. };
  1841.  
  1842. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1843. /*    • Constants for dragCntl message (passed in param)                                    */
  1844. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1845.  
  1846. enum {
  1847.     kDragControlEntireControl    = 0,
  1848.     kDragControlIndicator        = 1
  1849. };
  1850.  
  1851. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1852. /*    • Drag Constraint Structure for thumbCntl message (passed in param)                    */
  1853. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1854.  
  1855. struct IndicatorDragConstraint {
  1856.     Rect                             limitRect;
  1857.     Rect                             slopRect;
  1858.     DragConstraint                     axis;
  1859. };
  1860. typedef struct IndicatorDragConstraint    IndicatorDragConstraint;
  1861. typedef IndicatorDragConstraint *        IndicatorDragConstraintPtr;
  1862. typedef IndicatorDragConstraintPtr *    IndicatorDragConstraintHandle;
  1863.  
  1864.  
  1865. #if !TARGET_OS_MAC
  1866. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1867. /*    • QuickTime 3.0 Win32/unix notification    mechanism                                    */
  1868. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1869. /* Proc used to notify window that something happened to the control*/
  1870. typedef CALLBACK_API_C( void , ControlNotificationProcPtr )(WindowPtr theWindow, ControlHandle theControl, ControlNotification notification, long param1, long param2);
  1871. /*
  1872.    Proc used to prefilter events before handled by control.  A client of a control calls
  1873.    CTRLSetPreFilterProc() to have the control call this proc before handling the event.
  1874.    If the proc returns TRUE, the control can go ahead and handle the event.
  1875. */
  1876. typedef CALLBACK_API_C( Boolean , PreFilterEventProc )(ControlHandle theControl, EventRecord *theEvent);
  1877. EXTERN_API_C( long )
  1878. GetControlComponentInstance        (ControlHandle             theControl);
  1879.  
  1880. EXTERN_API_C( ControlHandle )
  1881. GetControlHandleFromCookie        (long                     cookie);
  1882.  
  1883. EXTERN_API_C( void )
  1884. SetControlDefProc                (short                     resID,
  1885.                                  ControlDefProcPtr         proc);
  1886.  
  1887. #endif  /*  !TARGET_OS_MAC */
  1888.  
  1889. #if CGLUESUPPORTED
  1890. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1891. /*    • C Glue                                                                            */
  1892. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1893. EXTERN_API_C( void )
  1894. dragcontrol                        (ControlHandle             theControl,
  1895.                                  Point *                startPt,
  1896.                                  const Rect *            limitRect,
  1897.                                  const Rect *            slopRect,
  1898.                                  short                     axis);
  1899.  
  1900. EXTERN_API_C( ControlHandle )
  1901. newcontrol                        (WindowPtr                 theWindow,
  1902.                                  const Rect *            boundsRect,
  1903.                                  const char *            title,
  1904.                                  Boolean                 visible,
  1905.                                  short                     value,
  1906.                                  short                     min,
  1907.                                  short                     max,
  1908.                                  short                     procID,
  1909.                                  long                     refCon);
  1910.  
  1911. EXTERN_API_C( short )
  1912. findcontrol                        (Point *                thePoint,
  1913.                                  WindowPtr                 theWindow,
  1914.                                  ControlHandle *        theControl);
  1915.  
  1916. EXTERN_API_C( void )
  1917. getcontroltitle                    (ControlHandle             theControl,
  1918.                                  char *                    title);
  1919.  
  1920. EXTERN_API_C( void )
  1921. setcontroltitle                    (ControlHandle             theControl,
  1922.                                  const char *            title);
  1923.  
  1924. EXTERN_API_C( short )
  1925. trackcontrol                    (ControlHandle             theControl,
  1926.                                  Point *                thePoint,
  1927.                                  ControlActionUPP         actionProc);
  1928.  
  1929. EXTERN_API_C( short )
  1930. testcontrol                        (ControlHandle             theControl,
  1931.                                  Point *                thePt);
  1932.  
  1933. #endif  /* CGLUESUPPORTED */
  1934.  
  1935. #if OLDROUTINENAMES
  1936. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1937. /*    • OLDROUTINENAMES                                                                    */
  1938. /*——————————————————————————————————————————————————————————————————————————————————————*/
  1939. /* Variants applicable to all controls (at least ones with text)*/
  1940.  
  1941. enum {
  1942.     useWFont                    = popupUseWFont
  1943. };
  1944.  
  1945.  
  1946. enum {
  1947.     kControlCheckboxUncheckedValue = kControlCheckBoxUncheckedValue,
  1948.     kControlCheckboxCheckedValue = kControlCheckBoxCheckedValue,
  1949.     kControlCheckboxMixedValue    = kControlCheckBoxMixedValue
  1950. };
  1951.  
  1952.  
  1953. enum {
  1954.     inLabel                        = kControlLabelPart,
  1955.     inMenu                        = kControlMenuPart,
  1956.     inTriangle                    = kControlTrianglePart,
  1957.     inButton                    = kControlButtonPart,
  1958.     inCheckBox                    = kControlCheckBoxPart,
  1959.     inUpButton                    = kControlUpButtonPart,
  1960.     inDownButton                = kControlDownButtonPart,
  1961.     inPageUp                    = kControlPageUpPart,
  1962.     inPageDown                    = kControlPageDownPart,
  1963.     inThumb                        = kControlIndicatorPart
  1964. };
  1965.  
  1966.  
  1967. enum {
  1968.     kNoHiliteControlPart        = kControlNoPart,
  1969.     kInLabelControlPart            = kControlLabelPart,
  1970.     kInMenuControlPart            = kControlMenuPart,
  1971.     kInTriangleControlPart        = kControlTrianglePart,
  1972.     kInButtonControlPart        = kControlButtonPart,
  1973.     kInCheckBoxControlPart        = kControlCheckBoxPart,
  1974.     kInUpButtonControlPart        = kControlUpButtonPart,
  1975.     kInDownButtonControlPart    = kControlDownButtonPart,
  1976.     kInPageUpControlPart        = kControlPageUpPart,
  1977.     kInPageDownControlPart        = kControlPageDownPart,
  1978.     kInIndicatorControlPart        = kControlIndicatorPart,
  1979.     kReservedControlPart        = kControlDisabledPart,
  1980.     kControlInactiveControlPart    = kControlInactivePart
  1981. };
  1982.  
  1983. #define SetCTitle(theControl, title) SetControlTitle(theControl, title)
  1984. #define GetCTitle(theControl, title) GetControlTitle(theControl, title)
  1985. #define UpdtControl(theWindow, updateRgn) UpdateControls(theWindow, updateRgn)
  1986. #define SetCtlValue(theControl, theValue) SetControlValue(theControl, theValue)
  1987. #define GetCtlValue(theControl) GetControlValue(theControl)
  1988. #define SetCtlMin(theControl, minValue) SetControlMinimum(theControl, minValue)
  1989. #define GetCtlMin(theControl) GetControlMinimum(theControl)
  1990. #define SetCtlMax(theControl, maxValue) SetControlMaximum(theControl, maxValue)
  1991. #define GetCtlMax(theControl) GetControlMaximum(theControl)
  1992. #define GetAuxCtl(theControl, acHndl) GetAuxiliaryControlRecord(theControl, acHndl)
  1993. #define SetCRefCon(theControl, data) SetControlReference(theControl, data)
  1994. #define GetCRefCon(theControl) GetControlReference(theControl)
  1995. #define SetCtlAction(theControl, actionProc) SetControlAction(theControl, actionProc)
  1996. #define GetCtlAction(theControl) GetControlAction(theControl)
  1997. #define SetCtlColor(theControl, newColorTable) SetControlColor(theControl, newColorTable)
  1998. #define GetCVariant(theControl) GetControlVariant(theControl)
  1999. #define getctitle(theControl, title) getcontroltitle(theControl, title)
  2000. #define setctitle(theControl, title) setcontroltitle(theControl, title)
  2001. #endif  /* OLDROUTINENAMES */
  2002.  
  2003.  
  2004.  
  2005.  
  2006.  
  2007.  
  2008.  
  2009. #if PRAGMA_STRUCT_ALIGN
  2010.     #pragma options align=reset
  2011. #elif PRAGMA_STRUCT_PACKPUSH
  2012.     #pragma pack(pop)
  2013. #elif PRAGMA_STRUCT_PACK
  2014.     #pragma pack()
  2015. #endif
  2016.  
  2017. #ifdef PRAGMA_IMPORT_OFF
  2018. #pragma import off
  2019. #elif PRAGMA_IMPORT
  2020. #pragma import reset
  2021. #endif
  2022.  
  2023. #ifdef __cplusplus
  2024. }
  2025. #endif
  2026.  
  2027. #endif /* __CONTROLS__ */
  2028.  
  2029.